/* =========================================================
   Ways to Decide — cartoon theme
   ========================================================= */
:root {
  --ink: #2B2340;
  --bg: #FFF6E5;
  --card: #fff;
  --muted: #6b6280;
  --yellow: #FFC83D;
  --pink: #FF6B9D;
  --red: #FF4D6D;
  --green: #6BCB77;
  --blue: #4D96FF;
  --radius: 22px;
  --shadow: 5px 5px 0 var(--ink);
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(43, 35, 64, .08) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1; }
a { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2rem, 6vw, 3.3rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
p { margin: 0 0 1em; }
code { background: var(--bg); padding: .1em .35em; border-radius: 6px; font-size: .9em; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 500; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 99; background: #fff; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; }
:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-header { padding: 14px 0 6px; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.35rem; letter-spacing: -.01em; }
.logo svg { width: 42px; height: 42px; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.logo:hover svg { transform: rotate(-25deg) scale(1.12); }
.logo b { color: var(--pink); margin: 0 .08em; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink);
  font-size: 1.15rem; cursor: pointer; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 1.1rem; line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .75em 1.5em; min-height: 52px;
  border: 3px solid var(--ink); border-radius: 999px;
  background: var(--accent, var(--yellow)); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .08s, background .2s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn--big { font-size: 1.3rem; padding: .8em 1.9em; }
.btn--ghost { background: #fff; }
.btn--sm { font-size: .95rem; padding: .45em .95em; min-height: 40px; box-shadow: 3px 3px 0 var(--ink); }
.btn--sm:active { box-shadow: 0 0 0 var(--ink); transform: translate(3px, 3px); }

/* ---------- Home hero ---------- */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; align-items: center; gap: 24px; padding-top: 28px; padding-bottom: 36px; }
.hero h1 .hl { background: var(--yellow); padding: 0 .18em; border-radius: .25em; -webkit-box-decoration-break: clone; box-decoration-break: clone; box-shadow: 3px 3px 0 var(--ink); border: 3px solid var(--ink); line-height: 1.35; }
.hero p { font-size: 1.2rem; color: var(--muted); max-width: 34ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-mascot { display: flex; justify-content: center; padding-top: 50px; }
.section-title { text-align: center; margin: 8px 0 24px; }

/* ---------- Tiles ---------- */
.tiles { list-style: none; padding: 0; margin: 0 0 48px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  min-height: 196px; height: 100%; padding: 20px 20px 18px;
  background: color-mix(in srgb, var(--tc) 28%, #fff);
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; overflow: hidden; isolation: isolate;
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.tile::before { content: ""; position: absolute; width: 170px; height: 170px; right: -50px; bottom: -60px; border-radius: 50%; background: var(--tc); border: 3px solid var(--ink); z-index: -1; }
.tile:hover, .tile:focus-visible { transform: translate(-3px, -3px) rotate(-1deg); box-shadow: 8px 8px 0 var(--ink); }
.tile:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.tile-emoji { font-size: 2.3rem; line-height: 1; display: inline-block; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.tile:hover .tile-emoji { transform: rotate(-15deg) scale(1.2); }
.tile-title { font-size: 1.4rem; margin: 0; }
.tile p { margin: 0; font-size: .98rem; max-width: 62%; color: color-mix(in srgb, var(--ink) 80%, transparent); }
.tile .mascot { position: absolute; right: 2px; bottom: -10px; --msize: 92px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.tile .mascot .m-body, .tile .mascot .m-hand, .tile .mascot .m-foot { fill: color-mix(in srgb, var(--mc) 55%, #fff); }
.tile:hover .mascot { transform: translateY(-10px) rotate(-6deg); }
.tiles--small .tile { min-height: 160px; }

/* ---------- Tool page ---------- */
.crumbs { font-size: .92rem; color: var(--muted); margin: 6px 0 10px; }
.crumbs a { text-decoration: none; font-weight: 600; color: var(--ink); }
.crumbs a:hover { text-decoration: underline; }
.tool-head { text-align: center; margin-bottom: 18px; }
.tool-head h1 { margin-bottom: .2em; }
.lede { color: var(--muted); font-size: 1.15rem; margin: 0 auto; max-width: 44ch; }

.stage {
  position: relative; overflow: hidden;
  background: #fff; border: 3px solid var(--ink); border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 34px 22px 30px; margin-bottom: 44px;
}
.stage::before { content: ""; position: absolute; inset: 0 0 auto; height: 12px; background: var(--accent); border-bottom: 3px solid var(--ink); }
.stage-grid { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; align-items: center; gap: 24px; min-height: 340px; }
.stage-grid--top { align-items: start; }
.stage-mascot { display: flex; justify-content: center; padding-top: 56px; }
.stage-play { display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }

.result { margin: 0; min-height: 1.4em; text-align: center; font-weight: 700; font-size: clamp(1.5rem, 5vw, 2.2rem); line-height: 1.2; }
.result--hint { font-size: 1.15rem; color: var(--muted); font-weight: 600; }
.result.pop { animation: pop-in .5s cubic-bezier(.3, 1.8, .5, 1); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: var(--bg); border: 2px solid var(--ink); border-radius: 999px; padding: .2em .85em; font-weight: 600; font-size: .95rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; min-width: 0; }
.field--wide { width: 100%; max-width: 460px; }
.input {
  font: inherit; font-size: 1.05rem; font-weight: 500; color: var(--ink);
  width: 100%; min-height: 50px; padding: .6em .85em;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: inset 3px 3px 0 rgba(43, 35, 64, .08);
}
textarea.input { resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--accent, var(--blue)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--blue)) 35%, transparent); }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; user-select: none; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }

/* segmented control */
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); background: #fff; }
.seg-btn { font: inherit; font-weight: 600; border: 0; background: transparent; padding: .55em 1em; cursor: pointer; min-height: 44px; color: var(--ink); }
.seg-btn + .seg-btn { border-left: 3px solid var(--ink); }
.seg-btn[aria-checked="true"] { background: var(--accent); }

/* ---------- Content cards ---------- */
.content { max-width: 780px; margin: 0 auto 30px; }
.card { background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.prose p:last-child { margin-bottom: 0; }
.prose a { font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 6px 48px; margin-bottom: 8px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 700; }
.faq details { border-top: 2px dashed rgba(43, 35, 64, .25); padding: 12px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; line-height: 1; transition: transform .2s; flex-shrink: 0; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 8px 0 0; color: #463d5c; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #fff; padding: 36px 0 30px; margin-top: 24px; }
.foot-title { font-weight: 700; font-size: 1.2rem; margin-bottom: 10px; }
.foot-links { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.foot-links a { color: #fff; text-decoration: none; opacity: .85; }
.foot-links a:hover { opacity: 1; text-decoration: underline; }
.site-footer small { opacity: .6; display: block; }

.notfound-wrap { text-align: center; padding-top: 70px; }
.notfound-wrap .lede { margin-bottom: 30px; }

/* =========================================================
   MASCOT
   ========================================================= */
.mascot { --ink: #2B2340; --lx: 0px; --ly: 0px; --ps: 1; position: relative; display: inline-block; width: var(--msize, 150px); flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.mascot--sm { --msize: 80px; }
.mascot--md { --msize: 130px; }
.mascot--lg { --msize: 200px; }
.mascot--xl { --msize: 260px; }
.mascot[data-poke] { cursor: pointer; }
.m-svg { display: block; width: 100%; height: auto; overflow: visible; }
.m-svg * { transform-box: fill-box; transform-origin: center; }

.m-wrap { transform-origin: 50% 100%; }
.m-shadow { fill: #000; opacity: .13; }
.m-body { fill: var(--mc); stroke: var(--ink); stroke-width: 5; }
.m-shine { fill: #fff; opacity: .55; }
.m-limb-o { fill: none; stroke: var(--ink); stroke-width: 16; stroke-linecap: round; }
.m-limb { fill: none; stroke: var(--mc); stroke-width: 7; stroke-linecap: round; }
.m-hand, .m-foot { fill: var(--mc); stroke: var(--ink); stroke-width: 4; }
.m-cheek { fill: #FF7A9A; opacity: .45; }
.m-brow { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.m-sclera { fill: #fff; stroke: var(--ink); stroke-width: 4; }
.m-iris { fill: var(--ink); }
.m-glint { fill: #fff; }
.m-pupil { transform: translate(var(--lx), var(--ly)) scale(var(--ps)); transition: transform .25s ease; }
.m-line, .m-strokes path { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.m-line.thin { stroke-width: 2.5; }
.m-mouth { fill: var(--ink); }
.m-tongue { fill: #FF6B8B; stroke: var(--ink); stroke-width: 3; }
.mouth-grin .m-tongue { stroke: none; }
.m-teeth { fill: #fff; stroke: var(--ink); stroke-width: 4; }
.m-sweat { fill: #8FDBFF; stroke: var(--ink); stroke-width: 3; }
.m-star { fill: #FFE14D; stroke: var(--ink); stroke-width: 2.5; }
.m-arm { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.m-svg .m-arm-l { transform-box: view-box; transform-origin: 44px 116px; }
.m-svg .m-arm-r { transform-box: view-box; transform-origin: 156px 116px; }
.m-svg .m-stars { transform-box: view-box; transform-origin: 100px 40px; }
.m-eye { animation: m-blink 4.6s infinite; }
.m-eye-r { transition: opacity .1s; }
.o { opacity: 0; transition: opacity .12s; }

/* --- which face parts are visible per mood --- */
.mascot[data-mood="idle"] :is(.eyes-normal, .mouth-smile),
.mascot[data-mood="wave"] :is(.eyes-normal, .mouth-smile),
.mascot[data-mood="nervous"] :is(.eyes-normal, .mouth-grimace, .m-sweat),
.mascot[data-mood="excited"] :is(.eyes-normal, .mouth-o),
.mascot[data-mood="happy"] :is(.eyes-happy, .mouth-grin, .m-stars),
.mascot[data-mood="shocked"] :is(.eyes-normal, .mouth-o, .m-sweat),
.mascot[data-mood="sad"] :is(.eyes-normal, .mouth-frown),
.mascot[data-mood="dizzy"] :is(.eyes-x, .mouth-wavy, .m-stars),
.mascot[data-mood="silly"] :is(.eyes-normal, .mouth-tongue, .wink-r),
.mascot[data-mood="thinking"] :is(.eyes-normal, .mouth-flat),
.mascot[data-mood="nod"] :is(.eyes-happy, .mouth-grin),
.mascot[data-mood="nope"] :is(.eyes-normal, .mouth-frown) { opacity: 1; }
.mascot[data-mood="silly"] .m-eye-r { opacity: 0; }

/* idle / wave */
.mascot[data-mood="idle"] .m-wrap,
.mascot[data-mood="wave"] .m-wrap { animation: m-breathe 3.2s ease-in-out infinite; }
.mascot[data-mood="wave"] .m-arm-r { animation: m-wave .9s ease-in-out infinite; }

/* nervous */
.mascot[data-mood="nervous"] .m-wrap { animation: m-shiver .14s linear infinite; }
.mascot[data-mood="nervous"] .m-brow-l { transform: translateY(-4px) rotate(-14deg); }
.mascot[data-mood="nervous"] .m-brow-r { transform: translateY(-4px) rotate(14deg); }
.mascot[data-mood="nervous"] .m-pupil { animation: m-dart .7s steps(1) infinite; }
.mascot[data-mood="nervous"] .m-arm-l { transform: rotate(45deg); }
.mascot[data-mood="nervous"] .m-arm-r { transform: rotate(-45deg); }

/* excited */
.mascot[data-mood="excited"] { --ly: -6px; }
.mascot[data-mood="excited"] .m-wrap { animation: m-bounce .45s ease-in-out infinite; }
.mascot[data-mood="excited"] .m-brow { transform: translateY(-7px); }
.mascot[data-mood="excited"] .m-arm-l { animation: m-arms-l .25s ease-in-out infinite alternate; }
.mascot[data-mood="excited"] .m-arm-r { animation: m-arms-r .25s ease-in-out infinite alternate; }

/* happy */
.mascot[data-mood="happy"] .m-wrap { animation: m-jump .55s ease-out 3, m-breathe 3.2s 1.65s ease-in-out infinite; }
.mascot[data-mood="happy"] .m-shadow { animation: m-shadow .55s ease-out 3; }
.mascot[data-mood="happy"] .m-brow { transform: translateY(-8px); }
.mascot[data-mood="happy"] .m-arm-l { transform: rotate(115deg); }
.mascot[data-mood="happy"] .m-arm-r { transform: rotate(-115deg); }
.mascot[data-mood="happy"] .m-star { animation: m-twinkle .5s ease-in-out infinite alternate; }

/* shocked */
.mascot[data-mood="shocked"] { --ps: .62; }
.mascot[data-mood="shocked"] .m-wrap { animation: m-pop .45s cubic-bezier(.3, 1.8, .5, 1); }
.mascot[data-mood="shocked"] .eyes-normal { transform: scale(1.14); }
.mascot[data-mood="shocked"] .mouth-o { transform: scale(1.6); }
.mascot[data-mood="shocked"] .m-brow { transform: translateY(-13px); }
.mascot[data-mood="shocked"] .m-arm-l { transform: rotate(140deg); }
.mascot[data-mood="shocked"] .m-arm-r { transform: rotate(-140deg); }

/* sad */
.mascot[data-mood="sad"] { --ly: 5px; }
.mascot[data-mood="sad"] .m-wrap { animation: m-droop 2.4s ease-in-out infinite; }
.mascot[data-mood="sad"] .m-brow-l { transform: rotate(-16deg); }
.mascot[data-mood="sad"] .m-brow-r { transform: rotate(16deg); }
.mascot[data-mood="sad"] .m-arm-l { transform: rotate(-12deg); }
.mascot[data-mood="sad"] .m-arm-r { transform: rotate(12deg); }

/* dizzy */
.mascot[data-mood="dizzy"] .m-wrap { animation: m-wobble .7s ease-in-out infinite; }
.mascot[data-mood="dizzy"] .m-stars { animation: m-orbit 1.1s linear infinite; }
.mascot[data-mood="dizzy"] .m-arm-l { animation: m-flail-l .35s ease-in-out infinite alternate; }
.mascot[data-mood="dizzy"] .m-arm-r { animation: m-flail-r .35s ease-in-out infinite alternate; }

/* silly */
.mascot[data-mood="silly"] .m-wrap { animation: m-tilt .4s ease-in-out infinite alternate; }
.mascot[data-mood="silly"] .m-brow-r { transform: translateY(5px) rotate(-8deg); }
.mascot[data-mood="silly"] .m-brow-l { transform: translateY(-6px); }
.mascot[data-mood="silly"] .m-arm-l { transform: rotate(120deg); }

/* thinking */
.mascot[data-mood="thinking"] { --lx: 6px; --ly: -6px; }
.mascot[data-mood="thinking"] .m-wrap { animation: m-sway 1.8s ease-in-out infinite; }
.mascot[data-mood="thinking"] .m-brow-r { transform: translateY(-9px) rotate(8deg); }
.mascot[data-mood="thinking"] .m-arm-r { transform: rotate(60deg); }

/* nod (yes) / nope (no) */
.mascot[data-mood="nod"] .m-wrap { animation: m-nod .32s ease-in-out 5, m-breathe 3.2s 1.6s ease-in-out infinite; }
.mascot[data-mood="nod"] .m-brow { transform: translateY(-8px); }
.mascot[data-mood="nod"] .m-arm-l { transform: rotate(110deg); }
.mascot[data-mood="nod"] .m-arm-r { transform: rotate(-110deg); }
.mascot[data-mood="nope"] .m-wrap { animation: m-nope .42s ease-in-out 4; }
.mascot[data-mood="nope"] .m-brow-l { transform: translateY(3px) rotate(16deg); }
.mascot[data-mood="nope"] .m-brow-r { transform: translateY(3px) rotate(-16deg); }
.mascot[data-mood="nope"] .m-arm-l { transform: rotate(70deg); }
.mascot[data-mood="nope"] .m-arm-r { transform: rotate(-70deg); }

/* speech bubble */
.bubble {
  position: absolute; bottom: calc(100% - 6px); left: 50%; z-index: 3;
  width: max-content; max-width: min(240px, 80vw);
  background: #fff; border: 3px solid var(--ink); border-radius: 18px;
  padding: .35em .8em; font-weight: 700; font-size: 1rem; line-height: 1.25; text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
  opacity: 0; transform: translate(-50%, 10px) scale(.5); transform-origin: 50% 100%;
  transition: opacity .15s, transform .25s cubic-bezier(.3, 1.7, .5, 1); pointer-events: none;
}
.bubble::after { content: ""; position: absolute; left: 50%; top: 100%; width: 14px; height: 14px; background: #fff; border: 3px solid var(--ink); border-top: 0; border-left: 0; transform: translate(-50%, -7px) rotate(45deg); }
.bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* mascot keyframes */
@keyframes m-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes m-breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.03, .97); } }
@keyframes m-wave { 0%, 100% { transform: rotate(-75deg); } 50% { transform: rotate(-118deg); } }
@keyframes m-shiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px) rotate(-1deg); } 75% { transform: translateX(2px) rotate(1deg); } }
@keyframes m-dart { 0% { transform: translate(-4px, 1px) scale(.9); } 50% { transform: translate(4px, 1px) scale(.9); } }
@keyframes m-bounce { 0%, 100% { transform: translateY(0) scale(1.04, .96); } 50% { transform: translateY(-14px) scale(.97, 1.03); } }
@keyframes m-arms-l { from { transform: rotate(90deg); } to { transform: rotate(125deg); } }
@keyframes m-arms-r { from { transform: rotate(-90deg); } to { transform: rotate(-125deg); } }
@keyframes m-jump { 0% { transform: scale(1.1, .9); } 40% { transform: translateY(-34px) scale(.94, 1.06); } 75% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; } }
@keyframes m-shadow { 40% { transform: scale(.65); opacity: .06; } }
@keyframes m-twinkle { from { transform: scale(.6) rotate(0); } to { transform: scale(1.25) rotate(45deg); } }
@keyframes m-pop { 0% { transform: scale(.85); } 55% { transform: translateY(-14px) scale(1.12, 1.1); } 100% { transform: none; } }
@keyframes m-droop { 0%, 100% { transform: translateY(5px) scale(1.03, .94); } 50% { transform: translateY(7px) scale(1.05, .92) rotate(-2deg); } }
@keyframes m-wobble { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes m-orbit { to { transform: rotate(360deg); } }
@keyframes m-flail-l { from { transform: rotate(40deg); } to { transform: rotate(140deg); } }
@keyframes m-flail-r { from { transform: rotate(-140deg); } to { transform: rotate(-40deg); } }
@keyframes m-tilt { from { transform: rotate(-7deg); } to { transform: rotate(7deg) translateY(-5px); } }
@keyframes m-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
@keyframes m-nod { 50% { transform: translateY(9px) scale(1.04, .93); } }
@keyframes m-nope { 0%, 100% { transform: none; } 25% { transform: translateX(-12px) rotate(-5deg); } 75% { transform: translateX(12px) rotate(5deg); } }
@keyframes pop-in { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* =========================================================
   COIN
   ========================================================= */
.coin-stage { position: relative; width: 100%; height: 260px; display: flex; align-items: flex-end; justify-content: center; perspective: 900px; }
.coin-toss { width: 160px; height: 160px; margin-bottom: 18px; }
.coin-toss.tossing { animation: coin-toss var(--dur, 1.6s) cubic-bezier(.33, 0, .67, 1); }
.coin-shadow { position: absolute; bottom: 6px; left: 50%; width: 130px; height: 18px; margin-left: -65px; border-radius: 50%; background: rgba(43, 35, 64, .18); }
.coin-shadow.tossing { animation: coin-shadow var(--dur, 1.6s) cubic-bezier(.33, 0, .67, 1); }
.coin {
  all: unset; display: block; position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur, 1.6s) cubic-bezier(.15, .6, .3, 1);
}
.coin:focus-visible { outline: 3px dashed var(--ink); outline-offset: 6px; border-radius: 50%; }
.coin-face {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  border: 5px solid var(--ink);
  background: radial-gradient(circle at 34% 28%, #FFF3B8 0, #FFD45A 32%, #FFC83D 55%, #E7A000 100%);
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, .14), inset 0 7px 0 rgba(255, 255, 255, .35);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.coin-face.tails { transform: rotateX(180deg); background: radial-gradient(circle at 34% 28%, #FFF3B8 0, #FFCF4F 32%, #F5B52A 60%, #D48F00 100%); }
.coin-face .ring { position: absolute; inset: 13px; border: 3px dashed rgba(43, 35, 64, .45); border-radius: 50%; }
.coin-face b { font-size: 4.4rem; line-height: 1; margin-top: -10px; color: var(--ink); text-shadow: 3px 3px 0 rgba(255, 255, 255, .5); }
.coin-face small { position: absolute; bottom: 30px; font-weight: 700; letter-spacing: .18em; font-size: .78rem; }
@keyframes coin-toss {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-170px) scale(1.18); }
  86% { transform: translateY(0) scale(1); }
  93% { transform: translateY(-16px) scale(1); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes coin-shadow { 45% { transform: scale(.45); opacity: .4; } 86% { transform: none; } }

/* =========================================================
   WHEEL
   ========================================================= */
.wheel-layout { display: grid; grid-template-columns: 1fr minmax(260px, 320px); gap: 28px; align-items: start; }
.wheel-col { display: flex; flex-direction: column; align-items: center; gap: 16px; min-width: 0; }
.wheel-wrap { position: relative; width: min(100%, 440px); aspect-ratio: 1; margin-top: 14px; }
.wheel-wrap canvas { display: block; width: 100%; height: 100%; filter: drop-shadow(5px 5px 0 var(--ink)); touch-action: manipulation; cursor: pointer; }
.wheel-pointer { position: absolute; top: -20px; left: 50%; width: 46px; height: 56px; margin-left: -23px; z-index: 2; transform-origin: 50% 30%; filter: drop-shadow(2px 2px 0 var(--ink)); }
.wheel-pointer.flick { animation: flick .14s ease-out; }
@keyframes flick { 40% { transform: rotate(-22deg); } }
.wheel-hub {
  position: absolute; inset: 0; margin: auto; width: 23%; height: 23%; border-radius: 50%; z-index: 2;
  font: inherit; font-weight: 700; font-size: clamp(.95rem, 3.6vw, 1.3rem); letter-spacing: .03em; color: var(--ink);
  background: #fff; border: 4px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform .1s; -webkit-tap-highlight-color: transparent;
}
.wheel-hub:hover { transform: scale(1.06); }
.wheel-hub:active { transform: scale(.95); }
.wheel-hub:disabled { cursor: default; transform: none; }
.wheel-mascot { position: absolute; left: -34px; bottom: -26px; z-index: 3; }
.wheel-mascot .bubble { left: 80%; }
.wheel-editor { display: flex; flex-direction: column; gap: 14px; }
.wheel-editor textarea { min-height: 230px; }
.wheel-editor .presets { justify-content: flex-start; }
.wheel-editor .row-btns { justify-content: flex-start; }

/* =========================================================
   DICE
   ========================================================= */
.dice-tray { display: flex; flex-wrap: wrap; gap: 34px; justify-content: center; align-items: center; perspective: 900px; min-height: 170px; padding: 24px 8px 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; outline-offset: 6px; border-radius: 20px; }
.die-wrap { --d: 88px; width: var(--d); height: var(--d); }
.die-wrap.hop { animation: die-hop var(--dur, 1.2s) cubic-bezier(.3, 0, .6, 1); }
.die { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform var(--dur, 1.2s) cubic-bezier(.2, .75, .25, 1); }
.die .face {
  position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 11%;
  background: #fff; border: 4px solid var(--ink); border-radius: 20%;
  box-shadow: inset -6px -6px 0 rgba(43, 35, 64, .1);
}
.die .face i { display: block; width: 74%; height: 74%; margin: auto; border-radius: 50%; }
.die .face i.p { background: var(--ink); }
.die .f1 i.p { background: var(--red); width: 100%; height: 100%; }
.die .f1 { transform: translateZ(calc(var(--d) / 2)); }
.die .f6 { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.die .f3 { transform: rotateY(90deg) translateZ(calc(var(--d) / 2)); }
.die .f4 { transform: rotateY(-90deg) translateZ(calc(var(--d) / 2)); }
.die .f5 { transform: rotateX(90deg) translateZ(calc(var(--d) / 2)); }
.die .f2 { transform: rotateX(-90deg) translateZ(calc(var(--d) / 2)); }
@keyframes die-hop { 0% { transform: translateY(0); } 30% { transform: translateY(-70px); } 60% { transform: translateY(0); } 75% { transform: translateY(-14px); } 100% { transform: translateY(0); } }

/* =========================================================
   MAGIC 8 BALL
   ========================================================= */
.ball {
  all: unset; position: relative; display: grid; place-items: center; cursor: pointer;
  width: min(250px, 66vw); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #6f6a85 0, #2a2440 32%, #0e0b18 70%);
  border: 4px solid var(--ink); box-shadow: 7px 7px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.ball:focus-visible { outline: 3px dashed var(--ink); outline-offset: 6px; }
.ball::after { content: ""; position: absolute; width: 26%; height: 14%; top: 12%; left: 20%; border-radius: 50%; background: rgba(255, 255, 255, .28); transform: rotate(-30deg); }
.ball.shake { animation: ball-shake 1.1s cubic-bezier(.36, .07, .19, .97); }
.ball-window { position: relative; width: 54%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle, #23308a, #0a0e33 75%); border: 5px solid #45405a; }
.ball-8 { position: absolute; inset: 0; display: grid; place-items: center; background: #fff; border-radius: 50%; color: #111; font-size: 3.8rem; font-weight: 700; transition: transform .45s, opacity .45s; }
.ball-8.gone { transform: scale(.2); opacity: 0; }
.triangle {
  display: grid; place-items: center; width: 92%; aspect-ratio: 1.08; margin-top: -8%;
  clip-path: polygon(50% 100%, 0 6%, 100% 6%);
  background: linear-gradient(#3d5bff, #2236c9); color: #fff;
  font-size: clamp(.78rem, 3.4vw, .95rem); font-weight: 700; line-height: 1.1; text-align: center; text-transform: uppercase;
  padding: 4% 17% 38%;
  opacity: 0; transform: scale(.4) rotate(-25deg) translateY(20px); filter: blur(4px);
  transition: opacity .7s, transform .9s cubic-bezier(.2, .9, .3, 1.2), filter .7s;
}
.triangle.show { opacity: 1; transform: none; filter: none; }
@keyframes ball-shake {
  10%, 90% { transform: translate(-6px, 2px) rotate(-6deg); }
  20%, 80% { transform: translate(12px, -6px) rotate(9deg); }
  30%, 50%, 70% { transform: translate(-18px, 6px) rotate(-12deg); }
  40%, 60% { transform: translate(18px, -8px) rotate(12deg); }
}

/* =========================================================
   YES / NO
   ========================================================= */
.answer-sign {
  display: grid; place-items: center; min-width: 220px; min-height: 150px; padding: 10px 30px;
  background: var(--bg); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 6px 6px 0 var(--ink);
  font-size: clamp(3.4rem, 15vw, 6rem); font-weight: 700; line-height: 1; letter-spacing: -.02em;
  transition: background .25s;
}
.answer-sign.yes { background: #B8F2BF; }
.answer-sign.no { background: #FFC2D1; }
.answer-sign.maybe { background: #FFE89A; }
.answer-sign.thinking span { animation: think-dots 1s steps(1) infinite; }
.answer-sign.pop { animation: sign-pop .55s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes sign-pop { 0% { transform: scale(.5) rotate(-8deg); } 100% { transform: none; } }
@keyframes think-dots { 50% { opacity: .35; } }

/* =========================================================
   ROCK PAPER SCISSORS
   ========================================================= */
.rps-arena { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 4vw, 28px); }
.rps-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rps-label { font-weight: 700; font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hand {
  display: grid; place-items: center; width: clamp(110px, 30vw, 150px); aspect-ratio: 1;
  font-size: clamp(3.6rem, 13vw, 5.2rem); line-height: 1;
  background: var(--bg); border: 4px solid var(--ink); border-radius: 28px; box-shadow: 5px 5px 0 var(--ink);
}
.hand--bot { transform: scaleX(-1); }
.hand.pump { animation: hand-pump .42s ease-in-out infinite; }
.hand--bot.pump { animation-name: hand-pump-bot; }
.hand.win { background: #B8F2BF; }
.hand.lose { background: #FFC2D1; }
.hand.reveal { animation: hand-reveal .45s cubic-bezier(.3, 1.8, .5, 1); }
.hand--bot.reveal { animation-name: hand-reveal-bot; }
.vs { font-weight: 700; font-size: 1.6rem; color: var(--pink); -webkit-text-stroke: 1.5px var(--ink); }
.rps-choices { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.rps-btn span { font-size: 1.5rem; }
@keyframes hand-pump { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-22px) rotate(-10deg); } }
@keyframes hand-pump-bot { 0%, 100% { transform: scaleX(-1) translateY(0) rotate(0); } 50% { transform: scaleX(-1) translateY(-22px) rotate(-10deg); } }
@keyframes hand-reveal { 0% { transform: scale(.4); } 100% { transform: none; } }
@keyframes hand-reveal-bot { 0% { transform: scaleX(-1) scale(.4); } 100% { transform: scaleX(-1); } }

/* =========================================================
   RANDOM NUMBER
   ========================================================= */
.num-display {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center;
  min-height: 150px; width: 100%; max-width: 560px; padding: 16px;
  background: var(--ink); border-radius: 26px; border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--accent) 70%, #fff), 6px 6px 0 rgba(43, 35, 64, .35);
}
.num-display .num { color: #fff; font-weight: 700; font-size: clamp(3rem, 14vw, 5.5rem); line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.num-display.many .num { font-size: clamp(1.2rem, 4.5vw, 1.8rem); background: rgba(255, 255, 255, .1); padding: .15em .5em; border-radius: 12px; }
.num-display.rolling .num { color: #FFE14D; filter: blur(.6px); }
.num-display.done .num { animation: pop-in .45s cubic-bezier(.3, 1.8, .5, 1); }
.num-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 460px; align-items: end; }
.num-form .check { grid-column: 1 / -1; justify-self: center; }
.num-form .btn { grid-column: 1 / -1; justify-self: center; }

/* =========================================================
   RANDOM PICKER
   ========================================================= */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 60px; max-width: 620px; padding-top: 6px; }
.pick-chip { padding: .45em 1em; background: #fff; border: 3px solid var(--ink); border-radius: 14px; font-weight: 600; box-shadow: 2px 2px 0 var(--ink); transition: transform .08s, background .08s; max-width: 100%; overflow-wrap: anywhere; }
.pick-chip.hot { background: var(--accent); transform: scale(1.12) rotate(-3deg); }
.pick-chip.winner { background: var(--yellow); transform: scale(1.22); box-shadow: 4px 4px 0 var(--ink); animation: chip-win .5s ease-in-out 3; position: relative; z-index: 1; }
.pick-chip.dim { opacity: .35; }
@keyframes chip-win { 50% { transform: scale(1.3) rotate(4deg); } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 860px) {
  .wheel-layout { grid-template-columns: 1fr; }
  .wheel-editor { width: 100%; max-width: 480px; margin: 0 auto; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 6px; gap: 6px; }
  .hero p { margin-left: auto; margin-right: auto; }
  .hero-cta { justify-content: center; }
  .hero-mascot { order: -1; padding-top: 44px; }
  .hero-mascot .mascot { --msize: 170px; }
  .stage { padding: 26px 14px 24px; border-radius: 24px; box-shadow: 5px 5px 0 var(--ink); }
  .stage-grid { grid-template-columns: 1fr; gap: 6px; min-height: 0; }
  .stage-mascot { padding-top: 44px; }
  .stage-mascot .mascot { --msize: 112px; }
  .num-display { min-height: 120px; }
  .coin-stage { height: 230px; }
  .coin-toss { width: 140px; height: 140px; }
  .coin-face b { font-size: 3.8rem; }
  .coin-face small { bottom: 24px; }
  .wheel-mascot { left: -12px; bottom: -22px; }
  .wheel-mascot .mascot { --msize: 96px; }
  .dice-tray { gap: 26px; }
  .die-wrap { --d: 74px; }
  .dice-tray.n4 .die-wrap, .dice-tray.n3 .die-wrap { --d: 62px; }
  .card { padding: 18px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 14px; }
  .tile { min-height: 168px; padding: 14px 12px; gap: 4px; }
  .tile p { display: none; }
  .tile-title { font-size: 1.08rem; }
  .tile-emoji { font-size: 1.9rem; }
  .tile .mascot { --msize: 74px; bottom: -8px; }
  .tile::before { width: 120px; height: 120px; right: -36px; bottom: -44px; }
  .btn--big { font-size: 1.15rem; padding: .75em 1.4em; }
  .hero-cta .btn { flex: 1 1 100%; }
  .rps-btn { padding: .6em 1em; font-size: 1rem; }
  .num-form { grid-template-columns: 1fr 1fr; }
  .num-form label:nth-child(3) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .m-arm, .m-brow, .m-pupil { transition: none; }
}
