@font-face{font-family:"Fredoka";src:url(fredoka.woff) format("woff");font-weight:300 700;font-display:swap}
:root{
  --page:#FFE7CF;--ink:#4A1738;--muted:#8A4E6E;--accent:#FF4F87;--lip:#C92E62;
  --btn:#FFFFFF;--btn-lip:#E9B894;--panel:#FFF6EC;--star:#FFC23D;--star-off:#F1D9C6;--warn:#E5213F;
  --board:#7A2E5C;--board-edge:#5E2146;--cell:#8E3C6D;
  --font:"Fredoka",ui-rounded,"Arial Rounded MT Bold","Segoe UI",system-ui,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0}
body{background:#F6D3B4;color:var(--ink);font-family:var(--font);display:flex;align-items:center;justify-content:center;overflow:hidden;
  -webkit-user-select:none;user-select:none;touch-action:manipulation}
.frame{position:relative;width:100vw;height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column;
  background:var(--page)}
@media (min-width:560px) and (min-height:680px){
  body{background:radial-gradient(circle at 30% 20%,#FFF1E4,#F2C7A5)}
  .frame{width:400px;height:min(820px,calc(100vh - 40px));border-radius:38px;box-shadow:0 0 0 10px #2B1424,0 30px 60px rgba(43,20,36,.35)}
}
.screens{position:relative;flex:1;min-height:0}
.screen{position:absolute;inset:0;display:none;flex-direction:column;padding:12px 16px 8px}
.screen.on{display:flex;animation:fade .25s ease}
@keyframes fade{from{opacity:0}to{opacity:1}}
button{font-family:inherit;color:inherit;border:0;background:none;padding:0;cursor:pointer}
/* Chunky buttons: a face sitting on a coloured lip */
.chunky{position:relative;display:flex;align-items:center;justify-content:center;gap:6px;height:54px;border-radius:16px;
  background:var(--btn);color:var(--ink);box-shadow:0 4px 0 var(--btn-lip);font-size:17px;font-weight:700;margin-bottom:4px;
  transition:transform .06s,box-shadow .06s;white-space:nowrap;padding:0 12px}
.chunky:active{transform:translateY(3px);box-shadow:0 1px 0 var(--btn-lip)}
.chunky.primary{background:var(--accent);color:#fff;box-shadow:0 4px 0 var(--lip)}
.chunky.primary:active{box-shadow:0 1px 0 var(--lip)}
.chunky.big{height:64px;font-size:22px}
.chunky svg{width:22px;height:22px;fill:currentColor;flex:none}
.chunky.icon{width:44px;height:44px;border-radius:14px;padding:0;flex:none}
.chunky.icon svg{width:24px;height:24px}
.chunky[disabled]{opacity:.45;pointer-events:none}
.row{display:flex;gap:10px}.row>.chunky{flex:1}
/* Home */
#home{justify-content:flex-end}
#home canvas{position:absolute;inset:0;width:100%;height:100%}
.title{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
.title h1{margin:0;font-size:64px;line-height:.95;font-weight:700;text-shadow:0 0 18px rgba(255,231,207,.9),0 0 6px rgba(255,231,207,.9)}
.title p{margin:12px 0 0;font-size:18px;font-weight:600;opacity:.8}
.demo-tag{display:inline-block;margin-top:14px;padding:4px 12px;border-radius:99px;background:rgba(255,255,255,.62);border:1.5px solid rgba(255,255,255,.9);font-size:14px;font-weight:600;color:var(--muted)}
#home .chunky{position:relative}
#home .row{margin-top:12px}
/* HUD */
.hud{display:flex;align-items:center;gap:10px}
.stat{display:flex;flex-direction:column;line-height:1}
.stat.end{align-items:flex-end}
.stat small{font-size:12px;font-weight:700;color:var(--muted);letter-spacing:1px}
.stat b{font-size:26px;font-weight:700}
.pill{flex:1;display:flex;justify-content:center;min-width:0}
.pill span{padding:7px 14px;border-radius:99px;background:rgba(255,255,255,.62);border:1.5px solid rgba(255,255,255,.9);font-size:17px;font-weight:700;white-space:nowrap}
.banner{display:none;align-items:center;gap:8px;margin-top:12px;padding:8px 6px 8px 14px;border-radius:16px;background:var(--star);color:#4A2A00;font-size:16px;font-weight:700;line-height:1.25}
.banner.on{display:flex}
.banner span{flex:1}.banner button{font-weight:700;font-size:15px;padding:8px 10px;color:#4A2A00}
.stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;margin:12px 0}
.board{line-height:0;touch-action:none}
.goal{display:flex;align-items:center;gap:8px;padding:6px 6px 6px 14px;border-radius:99px;background:var(--panel)}
.goal small{font-size:13px;font-weight:700;color:var(--muted);letter-spacing:1px}
.goal canvas,.line canvas{width:38px;height:38px}
.stat b.warn{color:var(--warn)}
.badge{position:absolute;top:-9px;right:-4px;padding:2px 7px;border-radius:99px;background:var(--accent);color:#fff;font-size:11px;font-weight:700}
#game{touch-action:none}
/* Levels */
#levels h2{margin:6px 0 0;font-size:28px;font-weight:700;flex:1}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:20px}
.lvl{aspect-ratio:1;border-radius:18px;background:var(--btn);box-shadow:0 4px 0 var(--btn-lip);display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:26px;font-weight:700}
.lvl:active{transform:translateY(3px);box-shadow:0 1px 0 var(--btn-lip)}
.lvl.next{background:var(--accent);color:#fff;box-shadow:0 4px 0 var(--lip)}
.lvl.locked{opacity:.45;pointer-events:none}
.lvl i{font-style:normal;font-size:13px;letter-spacing:1px;color:var(--star);line-height:1}
.lvl i .off{color:var(--star-off)}
.lvl.next i .off{color:rgba(255,255,255,.5)}
.more{margin-top:auto;text-align:center;color:var(--muted);font-size:15px;font-weight:600;padding:10px}
/* Overlay cards */
.overlay{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(255,231,207,.75);z-index:5;padding:16px}
.overlay.on{display:flex}
.card{width:100%;max-width:360px;background:var(--panel);border-radius:26px;padding:22px 20px 18px;box-shadow:0 12px 30px rgba(0,0,0,.25);animation:rise .28s cubic-bezier(.34,1.56,.64,1)}
@keyframes rise{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}
.card h3{margin:0 0 14px;font-size:28px;font-weight:700;line-height:1.1}
.card.center{text-align:center}.card.center h3{font-size:30px;margin:4px 0 8px}
.card .body{font-size:16px;font-weight:500;color:var(--muted);line-height:1.35;margin:0 0 20px}
.line{display:flex;gap:10px;align-items:flex-start;margin-bottom:10px;font-size:16px;font-weight:600;line-height:1.3}
.line svg{width:22px;height:22px;fill:var(--accent);flex:none}
.stars{display:flex;justify-content:center;align-items:flex-end;gap:2px;margin-bottom:6px}
.stars svg{fill:var(--star-off);width:56px;height:56px}
.stars svg:nth-child(2){width:72px;height:72px;margin-bottom:10px}
.stars svg.on{fill:var(--star);animation:star .6s cubic-bezier(.34,1.8,.64,1) both}
.stars svg.on:nth-child(2){animation-delay:.18s}.stars svg.on:nth-child(3){animation-delay:.36s}
@keyframes star{from{transform:scale(0)}to{transform:scale(1)}}
.card .gp-big{margin-top:12px}
/* Footer: mute + Google Play */
.bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 16px 10px;padding-bottom:max(10px,env(safe-area-inset-bottom));position:relative;z-index:6}
.mute{width:40px;height:40px;border-radius:12px;background:rgba(255,255,255,.62);border:1.5px solid rgba(255,255,255,.9);display:flex;align-items:center;justify-content:center}
.mute svg{width:22px;height:22px;fill:var(--ink)}
.gp{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 14px 0 10px;border-radius:12px;background:#1E1420;color:#fff;text-decoration:none;line-height:1.05}
.gp svg{width:20px;height:20px;flex:none}
.gp span{display:flex;flex-direction:column;font-size:15px;font-weight:600}
.gp small{font-size:9px;font-weight:600;letter-spacing:.8px;opacity:.85}
.gp.big{height:54px;width:100%;justify-content:center;border-radius:16px;box-shadow:0 4px 0 #000}
.gp.big span{font-size:19px}.gp.big small{font-size:10px}
.no-play .gp{display:none!important}
html.shot .screen.on,html.shot .card{animation:none}html.shot .stars svg.on{animation:none}
.card>.chunky{width:100%}

/* Arrow keys hint + buttons, computers only */
.keys{display:none;align-items:center;justify-content:center;gap:6px;margin:0 0 10px;flex-wrap:wrap}
body.mouse .keys{display:flex}
.keyhint{width:100%;text-align:center;font-size:14px;font-weight:600;color:var(--muted,#7A4E66);margin-bottom:2px}
.key{width:46px;height:40px;border-radius:12px;border:0;background:#fff;color:#4A1738;font-size:22px;font-weight:700;box-shadow:0 3px 0 #EBD3C2;cursor:pointer}
.key:active{transform:translateY(2px);box-shadow:0 1px 0 #EBD3C2}
