/* ============================================================
   FRACTION FACE — stylesheet
   Fixed 1280x720 stage, scaled to fit the window.
   ============================================================ */

:root {
  --tile: #f7d53f;
  --tile-dark: #e3bd25;
  --grout: #caa417;
  --floor: #2f8f9c;
  --floor2: #257a86;
  --green: #74c43a;
  --green-dark: #3f8a1a;
  --lime: #c9f26a;
  --orange: #ff8a2a;
  --red: #e5383b;
  --purple: #6a3fb5;
  --ink: #2a1d14;
  --cream: #fff8e7;
  --blue: #2fa8e0;
  --display: 'Luckiest Guy', 'Impact', sans-serif;
  --body: 'Nunito', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #15202b; font-family: var(--body); color: var(--ink); overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#viewport { position: fixed; inset: 0; overflow: hidden; }
#stage {
  position: absolute; left: 50%; top: 50%; margin-left: -640px; margin-top: -360px;
  width: 1280px; height: 720px; overflow: hidden;
  transform-origin: center center; border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  user-select: none;
}

/* ---------- background ---------- */
#bg { position: absolute; inset: 0; }
#bg .wall {
  position: absolute; inset: 0 0 150px 0;
  background-color: var(--tile);
  background-image:
    linear-gradient(var(--grout) 3px, transparent 3px),
    linear-gradient(90deg, var(--grout) 3px, transparent 3px),
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), transparent 55%);
  background-size: 80px 80px, 80px 80px, 80px 80px;
}
#bg .wall::before {
  /* a few colored tiles, like the box */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(#ffa64d, #ff8a2a) 160px 80px / 77px 77px no-repeat,
    linear-gradient(#5cc3f0, #2fa8e0) 960px 160px / 77px 77px no-repeat,
    linear-gradient(#96d95e, #74c43a) 1120px 400px / 77px 77px no-repeat,
    linear-gradient(#ff85b8, #ff5fa2) 80px 400px / 77px 77px no-repeat,
    linear-gradient(#9b73e0, #6a3fb5) 1040px 0px / 77px 77px no-repeat,
    linear-gradient(#ff6b6d, #e5383b) 400px 480px / 77px 77px no-repeat;
  opacity: .9;
}
#bg .wall::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,.18) 100%);
}
#bg .floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 150px;
  background-color: var(--floor);
  background-image:
    linear-gradient(45deg, var(--floor2) 25%, transparent 25%, transparent 75%, var(--floor2) 75%),
    linear-gradient(45deg, var(--floor2) 25%, transparent 25%, transparent 75%, var(--floor2) 75%);
  background-size: 60px 60px; background-position: 0 0, 30px 30px;
  box-shadow: inset 0 14px 20px rgba(0,0,0,.35);
}
#bg .splash { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
#bg .splash.s1 { width: 220px; height: 70px; left: 30px; bottom: 30px; background: #9fe4ea; }
#bg .splash.s2 { width: 160px; height: 50px; right: 60px; bottom: 50px; background: #9fe4ea; }

/* ---------- logo ---------- */
#logo { position: absolute; left: 24px; top: 14px; width: 300px; height: 160px; pointer-events: none; z-index: 5; }
#logo .splat { position: absolute; inset: 0; width: 300px; height: 160px; fill: var(--green); filter: drop-shadow(0 4px 0 var(--green-dark)); }
#logo .word {
  position: absolute; left: 0; width: 300px; text-align: center;
  font-family: var(--display); color: #fff;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 5px 0 var(--ink);
  letter-spacing: 2px;
}
#logo .word.top { top: 18px; font-size: 54px; transform: rotate(-6deg); color: #ffd84a; }
#logo .word.bottom { top: 64px; font-size: 68px; transform: rotate(-4deg); color: #fff; }
#logo .starring { position: absolute; left: 0; width: 300px; top: 136px; text-align: center; font-weight: 900; font-size: 15px; color: var(--ink); letter-spacing: 1px; text-transform: uppercase; }

/* ---------- Chester ---------- */
#chester-wrap { position: absolute; left: 60px; bottom: 60px; width: 380px; height: 446px; z-index: 6; }
#chester-shadow { position: absolute; left: 40px; right: 40px; bottom: -14px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.35); filter: blur(6px); }
#chester { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 8px rgba(0,0,0,.25)); }
#chester .hit { fill: transparent; cursor: pointer; }
#chester #body { transform-origin: 200px 440px; animation: idle 3.2s ease-in-out infinite; }
#chester .cheek { transform-origin: 200px 262px; }
#chester #cheekL { transform-origin: 135px 262px; }
#chester #cheekR { transform-origin: 265px 262px; }
#chester .lid { transform-origin: center top; transform: scaleY(0); transition: transform .08s; }
#chester .lid { transform-box: fill-box; }
#chester.blink .lid { transform: scaleY(1); }
#chester #browL, #chester #browR { transform-box: fill-box; transform-origin: center; transition: transform .25s; }
#chester.surprised #browL { transform: translateY(-14px) rotate(-8deg); }
#chester.surprised #browR { transform: translateY(-14px) rotate(8deg); }
#chester.surprised .pupil { transform: scale(1.25); transform-box: fill-box; transform-origin: center; }
#chester.happy #browL { transform: translateY(-6px); }
#chester.happy #browR { transform: translateY(-6px); }
#chester.think #browL { transform: translateY(-10px) rotate(10deg); }
#chester.think #browR { transform: translateY(4px) rotate(10deg); }
#chester #hair { transform-origin: 205px 115px; transform-box: view-box; animation: hair 2.6s ease-in-out infinite; }

#chester.jiggle #cheekL { animation: jiggleL .55s ease-out; }
#chester.jiggle #cheekR { animation: jiggleR .55s ease-out; }
#chester.chew #cheekL { animation: chewL .5s ease-in-out 2; }
#chester.chew #cheekR { animation: chewR .5s ease-in-out 2; }

#chester.dance #body { animation: dance .46s ease-in-out infinite; }
#chester.dance #cheekL { animation: jiggleL .46s ease-in-out infinite; }
#chester.dance #cheekR { animation: jiggleR .46s ease-in-out infinite; }
#chester.dance #hair { animation: hairDance .46s ease-in-out infinite; }
#chester.dance #handL, #chester.dance #handR { animation: hands .46s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#chester.dance #handR { animation-delay: .23s; }
#chester.dance #cupL, #chester.dance #cupR { animation: cupBob .46s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#chester.dance ~ #chester-shadow { animation: shadowDance .46s ease-in-out infinite; }
#chester.sniff #body { animation: sniff 1.1s ease-in-out 1; }
#chester.bounce #body { animation: bounce .5s ease-out 1; }

@keyframes idle { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(-6px) scale(1.012,.988); } }
@keyframes hair { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes jiggleL { 0% { transform: scale(1) rotate(0); } 25% { transform: scale(1.08,.94) rotate(-4deg); } 50% { transform: scale(.95,1.06) rotate(3deg); } 75% { transform: scale(1.04,.97) rotate(-2deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes jiggleR { 0% { transform: scale(1) rotate(0); } 25% { transform: scale(1.08,.94) rotate(4deg); } 50% { transform: scale(.95,1.06) rotate(-3deg); } 75% { transform: scale(1.04,.97) rotate(2deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes chewL { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1,.9); } }
@keyframes chewR { 0%,100% { transform: scale(1); } 50% { transform: scale(.9,1.1); } }
@keyframes dance { 0% { transform: translateY(0) rotate(-7deg) scale(1.03,.97); } 50% { transform: translateY(-34px) rotate(7deg) scale(.96,1.05); } 100% { transform: translateY(0) rotate(-7deg) scale(1.03,.97); } }
@keyframes hairDance { 0%,100% { transform: rotate(-16deg) scaleY(1.1); } 50% { transform: rotate(16deg) scaleY(.9); } }
@keyframes hands { 0%,100% { transform: translateY(0) rotate(-20deg); } 50% { transform: translateY(-28px) rotate(20deg); } }
@keyframes cupBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shadowDance { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.8); opacity: .6; } }
@keyframes sniff { 0% { transform: translateX(0) rotate(0); } 30% { transform: translateX(60px) rotate(8deg) scale(1.04); } 60% { transform: translateX(70px) rotate(10deg) scale(1.08,.96); } 100% { transform: translateX(0) rotate(0); } }
@keyframes bounce { 0% { transform: translateY(0); } 40% { transform: translateY(-40px) scale(.95,1.08); } 70% { transform: translateY(0) scale(1.06,.94); } 100% { transform: translateY(0); } }

#press-head {
  position: absolute; left: 50%; top: -40px; transform: translateX(-50%);
  font-family: var(--display); font-size: 28px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink); animation: pulse .8s ease-in-out infinite; white-space: nowrap; pointer-events: none;
}
@keyframes pulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.12); } }

/* puffs */
#puffs circle { fill: url(#puffGrad); }

/* ---------- speech bubble ---------- */
#bubble {
  position: absolute; left: 440px; top: 36px; width: 600px; min-height: 120px;
  background: #fff; border: 5px solid var(--ink); border-radius: 26px;
  padding: 14px 56px 14px 14px; z-index: 8;
  box-shadow: 6px 8px 0 rgba(0,0,0,.25);
  font-weight: 800; font-size: 21px; line-height: 1.25;
  animation: bubbleIn .25s ease-out;
  display: grid; grid-template-columns: 96px 1fr; column-gap: 14px; align-items: start;
}
#bubble .prof-col { display: grid; justify-items: center; row-gap: 2px; }
#prof { width: 96px; height: 96px; overflow: visible; }
#prof #profHead { transform-box: view-box; transform-origin: 60px 90px; }
#bubble.talk #profHead { animation: profBob .35s ease-in-out infinite; }
@keyframes profBob { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-2px); } }
#prof #profOpen { transform-origin: 60px 85px; transform-box: view-box; transform: scaleY(0); }
#bubble.talk #profSmile { opacity: 0; }
#bubble.talk #profOpen { transform: scaleY(var(--mouth, .6)); }
.prof-name { white-space: nowrap; font-family: var(--display); font-size: 12px; letter-spacing: 1px; color: var(--ink); background: var(--lime); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 6px; }
#bubble-text { padding-top: 6px; }
@keyframes bubbleIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#bubble-text .w { transition: color .08s, background .08s; border-radius: 4px; padding: 0 1px; }
#bubble-text .w.on { color: var(--green-dark); background: var(--lime); }
#bubble-text .w.done { color: #333; }
#replay { position: absolute; right: 10px; top: 10px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream);
  font-size: 20px; display: grid; place-items: center; box-shadow: 2px 3px 0 rgba(0,0,0,.3);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.icon-btn.top-right { position: absolute; right: 18px; top: 18px; z-index: 20; }
.icon-btn.muted { opacity: .5; text-decoration: line-through; }

/* ---------- work area ---------- */
#work { position: absolute; left: 440px; top: 200px; width: 820px; height: 400px; z-index: 4; }
#work > * { position: absolute; }
.card {
  background: var(--cream); border: 5px solid var(--ink); border-radius: 22px;
  box-shadow: 6px 8px 0 rgba(0,0,0,.25);
  animation: popIn .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.caption {
  font-family: var(--display); font-size: 26px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink); letter-spacing: 1px; text-align: center;
}

/* pizza */
.pizza { width: 340px; height: 340px; overflow: visible; filter: drop-shadow(0 12px 10px rgba(0,0,0,.35)); }
.pizza .slice { cursor: pointer; transition: transform .25s cubic-bezier(.2,1.4,.4,1), filter .2s; }
.pizza .slice.locked { cursor: default; }
.pizza .slice:not(.locked):hover { filter: brightness(1.12) drop-shadow(0 0 10px #fff); }
.pizza .slice.eaten { display: none; }
.pizza .cut { stroke: #c1392b; stroke-width: 3; opacity: .9; }
.pizza.small { width: 220px; height: 220px; }
.pizza-label { font-family: var(--display); font-size: 34px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); text-align: center; }

/* number picker */
.picker { display: flex; gap: 10px; }
.picker button {
  width: 64px; height: 64px; border-radius: 16px; border: 4px solid var(--ink); background: #fff;
  font-family: var(--display); font-size: 34px; color: var(--ink); box-shadow: 4px 5px 0 rgba(0,0,0,.3);
  transition: transform .1s;
}
.picker button:hover { transform: translateY(-3px); background: var(--lime); }
.picker button.on { background: var(--green); color: #fff; -webkit-text-stroke: 1px var(--ink); }
.picker button:disabled { opacity: .4; transform: none; }

/* fraction card */
.frac-card { min-width: 230px; padding: 14px 14px; display: grid; grid-template-columns: 1fr; justify-items: center; gap: 4px; }
.frac { display: grid; grid-template-columns: auto auto auto; align-items: stretch; column-gap: 8px; }
.frac .col { display: grid; justify-items: center; align-content: center; }
.frac .arrows-col { display: grid; grid-template-rows: 1fr 1fr; align-items: center; }
.frac .num, .frac .den {
  font-family: var(--display); font-size: 84px; line-height: 1; min-width: 90px; text-align: center; padding: 2px 10px; border-radius: 16px;
  color: var(--ink); transition: background .25s, color .25s, transform .25s;
}
.frac .num.lit { background: var(--orange); color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; transform: scale(1.08); }
.frac .den.lit { background: var(--blue); color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; transform: scale(1.08); }
.frac .num.flash, .frac .den.flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }
.frac .bar { width: 120px; height: 10px; background: var(--ink); border-radius: 5px; margin: 6px 0; }
.frac .num.q, .frac .den.q { color: #bbb; }
.frac .arrows { display: grid; gap: 6px; }
.frac .arrows button {
  width: 46px; height: 40px; border-radius: 10px; border: 3px solid var(--ink); background: #fff; font-size: 20px; font-weight: 900;
  box-shadow: 3px 3px 0 rgba(0,0,0,.3);
}
.frac .arrows button:hover { background: var(--lime); }
.frac .arrows button:active { transform: translateY(2px); box-shadow: none; }
.frac .num.tap, .frac .den.tap { cursor: pointer; }
.frac .num.tap:hover, .frac .den.tap:hover { background: var(--lime); }
.tag {
  display: inline-block; padding: 6px 12px; border-radius: 12px; border: 3px solid var(--ink);
  font-family: var(--display); font-size: 22px; letter-spacing: 1px; color: #fff; text-align: center; line-height: 1;
  animation: popIn .35s cubic-bezier(.2,1.4,.4,1);
}
.tag small { display: block; font-family: var(--body); font-size: 12px; font-weight: 900; letter-spacing: 0; margin-top: 3px; text-transform: uppercase; }
.tag.top { background: var(--orange); }
.tag.bottom { background: var(--blue); }
.tag.result { background: var(--green); }
.piece-name { font-family: var(--display); font-size: 30px; color: var(--blue); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }

.check-btn, .choice, .big-btn {
  border: 4px solid var(--ink); border-radius: 18px; background: var(--green); color: #fff;
  font-family: var(--display); font-size: 28px; letter-spacing: 1px; padding: 10px 24px;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; box-shadow: 4px 6px 0 rgba(0,0,0,.3);
  transition: transform .1s;
}
.check-btn:hover, .choice:hover, .big-btn:hover { transform: translateY(-3px); filter: brightness(1.08); }
.check-btn:active, .choice:active, .big-btn:active { transform: translateY(2px); box-shadow: none; }
.choice { background: #fff; color: var(--ink); -webkit-text-stroke: 0; font-family: var(--body); font-weight: 900; font-size: 24px; }
.choice:hover { background: var(--lime); }
.choice.right { background: var(--green); color: #fff; }
.choice.wrong { background: #ddd; color: #888; animation: shake .4s; }
.choices { display: grid; gap: 12px; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Toot Tank */
.tank { width: 150px; height: 400px; overflow: visible; filter: drop-shadow(0 8px 8px rgba(0,0,0,.3)); }
.tank .glass { fill: rgba(255,255,255,.35); stroke: var(--ink); stroke-width: 6; }
.tank .gas { fill: url(#gasGrad); transition: height .6s cubic-bezier(.2,1.2,.4,1), y .6s cubic-bezier(.2,1.2,.4,1); }
.tank .tick { stroke: var(--ink); stroke-width: 3; }
.tank .ticklabel { font-family: var(--body); font-weight: 900; font-size: 14px; fill: var(--ink); }
.tank .bubble { fill: rgba(255,255,255,.6); animation: rise 2.4s linear infinite; }
.tank .bubble:nth-child(2) { animation-delay: .8s; } .tank .bubble:nth-child(3) { animation-delay: 1.6s; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-120px); opacity: 0; } }
.tank-label { font-family: var(--display); font-size: 24px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); text-align: center; }
.tank.overflow .glass { animation: shake .3s infinite; }
.tank.small { width: 120px; height: 320px; }
.frac-card.compact .num, .frac-card.compact .den { font-size: 64px; min-width: 76px; }
.nline .sub { font-size: 15px; }

/* number line */
.nline { width: 560px; height: 110px; overflow: visible; }
.nline .axis { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.nline .tick { stroke: var(--ink); stroke-width: 3; }
.nline .lbl { font-family: var(--display); font-size: 26px; fill: var(--ink); text-anchor: middle; }
.nline .sub { font-family: var(--body); font-weight: 900; font-size: 15px; fill: #333; text-anchor: middle; }
.nline .marker { transition: transform .6s cubic-bezier(.2,1.2,.4,1); }
.nline .ghost { opacity: .45; transition: transform .6s; }

/* ---------- bottom bar ---------- */
#bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; z-index: 9; display: flex; align-items: center; padding: 0 20px; gap: 10px; }
#chapters { display: flex; gap: 8px; }
.chap {
  border: 3px solid var(--ink); background: rgba(255,248,231,.9); border-radius: 999px; padding: 6px 14px 6px 6px;
  font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--ink);
  box-shadow: 2px 3px 0 rgba(0,0,0,.3);
}
.chap .n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--display); font-size: 16px; }
.chap.on { background: var(--green); color: #fff; }
.chap.on .n { background: #fff; color: var(--ink); }
.chap.done .n { background: var(--green-dark); }
.chap:hover { transform: translateY(-2px); }
.next-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  border: 4px solid var(--ink); border-radius: 999px; background: var(--orange); color: #fff;
  font-family: var(--display); font-size: 26px; letter-spacing: 2px; padding: 6px 16px 6px 22px;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; box-shadow: 4px 5px 0 rgba(0,0,0,.3);
  animation: nextPulse 1.2s ease-in-out infinite;
}
.next-btn svg { width: 30px; height: 30px; fill: #fff; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.next-btn:active { transform: translateY(2px); box-shadow: none; }
@keyframes nextPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- title overlay ---------- */
.overlay { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(20,10,0,.35); backdrop-filter: blur(2px); }
.title-card {
  width: 640px; padding: 40px 30px 36px; text-align: center;
  background: var(--cream); border: 6px solid var(--ink); border-radius: 30px; box-shadow: 10px 14px 0 rgba(0,0,0,.35);
  animation: popIn .5s cubic-bezier(.2,1.4,.4,1); position: relative; left: 180px;
}
.title-sub { font-weight: 900; font-size: 20px; letter-spacing: 2px; text-transform: uppercase; color: #777; }
.title-big { font-family: var(--display); font-size: 54px; line-height: 1.05; color: var(--ink); margin: 10px 0 26px; }
.title-big span { color: var(--green-dark); }
.big-btn { font-size: 38px; padding: 14px 40px; animation: nextPulse 1.2s ease-in-out infinite; }
.big-btn.lime { background: var(--orange); }

/* ---------- confetti ---------- */
#confetti { position: absolute; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(760px) rotate(720deg); opacity: .9; } }

/* stars */
.stars { font-size: 44px; letter-spacing: 6px; text-align: center; }
.stars .on { color: #ffcc00; text-shadow: 2px 2px 0 var(--ink); }
.stars .off { color: #ccc; }

/* aroma lines */
.aroma { position: absolute; pointer-events: none; }
.aroma path { fill: none; stroke: #7a7a7a; stroke-width: 5; stroke-linecap: round; opacity: 0; animation: aroma 1.4s ease-out forwards; }
.aroma path:nth-child(2) { animation-delay: .2s; } .aroma path:nth-child(3) { animation-delay: .4s; }
@keyframes aroma { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: .8; } 100% { opacity: 0; transform: translateY(-60px); } }

/* fly layer */
#fly { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
#fly svg { position: absolute; overflow: visible; }

/* hint text */
.hint { font-weight: 900; font-size: 18px; color: #555; text-align: center; }

#fx * { pointer-events: none; }

/* ---------- player picker ---------- */
.title-card .title-sub { font-size: 15px; }
.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.player-btn {
  border: 4px solid var(--ink); border-radius: 18px; background: #fff; padding: 8px 12px; text-align: left;
  display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; color: var(--ink);
  box-shadow: 4px 5px 0 rgba(0,0,0,.3); transition: transform .1s;
}
.player-btn:hover { transform: translateY(-3px); background: var(--lime); }
.player-btn .badge { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-size: 24px; color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }
.player-btn .pname { display: grid; line-height: 1.1; }
.player-btn .pname small { font-size: 12px; color: #666; font-weight: 800; }
.new-player { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 6px 0 16px; }
.new-player input { font: 900 26px var(--body); border: 4px solid var(--ink); border-radius: 14px; padding: 8px 14px; width: 300px; text-align: center; background: #fff; color: var(--ink); outline: none; }
.new-player input:focus { box-shadow: 0 0 0 4px var(--lime); }
.resume .welcome { font-weight: 900; font-size: 30px; margin: 6px 0 18px; }
.resume .welcome small { display: block; font-size: 18px; color: #666; margin-top: 6px; }
.resume .check-btn { margin-left: 12px; }
.chap.who { margin-left: 6px; background: var(--lime); }

/* player delete */
.player-row { display: flex; gap: 6px; align-items: stretch; }
.player-row .player-btn { flex: 1; }
.player-del {
  flex: none; width: 34px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: #999;
  font-weight: 900; font-size: 16px; box-shadow: 3px 3px 0 rgba(0,0,0,.3);
}
.player-del:hover { background: var(--red); color: #fff; }
.player-row.confirm {
  grid-column: 1 / -1;
  border: 4px solid var(--red); border-radius: 18px; background: #fff; padding: 8px 10px; gap: 8px; align-items: center;
  font-weight: 900; font-size: 15px; line-height: 1.15;
}
.player-row.confirm .confirm-msg { flex: 1; text-align: left; }
.confirm-yes, .confirm-no {
  border: 3px solid var(--ink); border-radius: 12px; font-family: var(--display); font-size: 15px; letter-spacing: 1px; padding: 6px 10px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.3); color: #fff; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill;
}
.confirm-yes { background: var(--red); }
.confirm-no { background: var(--green); }
.confirm-yes:active, .confirm-no:active { transform: translateY(2px); box-shadow: none; }

/* ---------- hop line ---------- */
.hopline { overflow: visible; }
.hopline .axis { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.hopline .tick { stroke: var(--ink); stroke-width: 3; }
.hopline .tick.whole { stroke-width: 6; }
.hopline .lbl { font-family: var(--display); font-size: 28px; fill: var(--ink); text-anchor: middle; }
.hopline .sub { font-family: var(--body); font-weight: 900; font-size: 14px; fill: #333; text-anchor: middle; }
.hopline.compact .lbl { font-size: 22px; }
.hopline.compact .sub { font-size: 12px; }
.hopline .beam { fill: rgba(116,196,58,.45); }
.hopline .flag-label, .hopline .ghost-label { font-family: var(--display); font-size: 22px; fill: var(--ink); text-anchor: middle; }
.hopline .hopper { will-change: transform; }
.hop-btn { font-size: 34px; padding: 10px 34px; background: var(--orange); }
.hop-btn:disabled { opacity: .5; transform: none; }
.picker.shake { animation: shake .4s; }

/* ---------- stacked lines ---------- */
.stack .axis { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.stack .tick { stroke: var(--ink); stroke-width: 3; }
.stack .tick.whole { stroke-width: 5; }
.stack .name { font-family: var(--display); font-size: 20px; fill: var(--ink); }
.stack .sub { font-family: var(--body); font-weight: 900; font-size: 13px; fill: #333; text-anchor: middle; }
.stack .sub.on { fill: var(--green-dark); font-size: 15px; }
.stack .hit { fill: transparent; cursor: pointer; }
.stack .dot { fill: var(--green); stroke: var(--ink); stroke-width: 3; display: none; }
.stack .dot.on { display: block; }
.stack .beam { fill: rgba(116,196,58,.35); }

/* ---------- compare rows ---------- */
.cmp-row { display: flex; align-items: center; gap: 10px; cursor: pointer; border: 4px solid transparent; border-radius: 22px; padding: 6px 10px; transition: background .15s; }
.cmp-row:hover { background: rgba(255,255,255,.4); }
.cmp-row.win { border-color: var(--green-dark); background: rgba(201,242,106,.55); }
.cmp-row.lose { opacity: .5; }
.cmp-who { flex: none; width: 118px; text-align: center; font-family: var(--display); font-size: 20px; color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 4px; box-shadow: 3px 3px 0 rgba(0,0,0,.3); }
.cmp-who.orange { background: var(--orange); }
.cmp-who.blue { background: var(--blue); }
.cmp-frac { flex: none; width: 70px; text-align: center; font-family: var(--display); font-size: 30px; line-height: 1; color: var(--ink); display: grid; justify-items: center; }
.cmp-frac .bar { width: 44px; height: 5px; background: var(--ink); border-radius: 3px; margin: 3px 0; }
