*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#ffe3f1;color:#3a2350;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;user-select:none;-webkit-user-select:none}
#cv{position:fixed;inset:0;width:100%;height:100%;touch-action:none;display:block}
button{font:inherit;color:inherit;border:0;cursor:pointer;min-width:48px;min-height:48px;border-radius:24px;
  background:#fff;box-shadow:0 2px 0 rgba(90,40,120,.25);transition:transform .08s,filter .12s}
button:hover{filter:brightness(1.06)}
button:active{transform:scale(.94)}
button:focus-visible{outline:3px solid #7a3fd0;outline-offset:2px}
button:disabled{opacity:.45;cursor:default}
.big{background:#e0447f;color:#fff;font-weight:700;font-size:18px;padding:0 28px}

#hud{position:fixed;top:0;left:0;right:0;display:none;align-items:center;gap:8px;padding:8px 10px;pointer-events:none}
#hud>*{pointer-events:auto}
#home{font-size:22px}
#steps{flex:1;display:flex;justify-content:center;gap:6px;flex-wrap:wrap}
#steps span{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.75);display:grid;place-items:center;font-size:18px;border:3px solid transparent}
#steps .cur{border-color:#e0447f;background:#fff;transform:scale(1.12)}
#steps .ok{background:#63c98a}
#coins,.coin{background:#fff;border-radius:20px;padding:8px 12px;font-weight:700;white-space:nowrap}

#tray{position:fixed;left:0;right:0;bottom:0;display:none;flex-direction:column;gap:6px;
  padding:10px 10px max(10px,env(safe-area-inset-bottom));background:#7a4fc4;border-radius:22px 22px 0 0}
#top{display:flex;align-items:center;gap:10px;min-height:48px}
#msg{flex:1;color:#fff;font-weight:600;font-size:16px;line-height:1.25}
#next{display:none}
#prog{height:8px;border-radius:4px;background:rgba(255,255,255,.3);overflow:hidden}
#bar{display:block;height:100%;width:0;background:#ffd24a;border-radius:4px}
#row{display:flex;align-items:center;gap:6px}
#prev,#nxt{font-size:26px;font-weight:700;flex:0 0 48px}
#car{flex:1;display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:2px;scroll-behavior:smooth}
#car::-webkit-scrollbar{display:none}
.it{flex:0 0 72px;height:72px;padding:0;border-radius:14px;border:4px solid #fff;overflow:hidden;position:relative;background:#ffe9f4}
.it canvas{width:100%;height:100%;display:block}
.it.sel{border-color:#ffd24a;box-shadow:0 0 0 2px #ffd24a}
.it .lk{position:absolute;inset:0;background:rgba(40,20,70,.55);color:#fff;font-size:12px;font-weight:700;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.it .no{position:absolute;inset:0;display:grid;place-items:center;font-size:30px}

#toast{position:fixed;top:72px;left:50%;transform:translateX(-50%);background:#fff;border-radius:20px;padding:8px 16px;
  font-weight:700;opacity:0;pointer-events:none}
#toast.on{animation:toast 1.6s}
@keyframes toast{0%{opacity:0;margin-top:14px}15%,75%{opacity:1;margin-top:0}100%{opacity:0;margin-top:-14px}}
#flash{position:fixed;inset:0;background:#fff;opacity:0;pointer-events:none;transition:opacity .35s}
#flash.on{opacity:1;transition:none}

#ov{position:fixed;inset:0;display:none;align-items:center;justify-content:center;padding:12px;background:rgba(60,30,90,.35)}
#ov.low{align-items:flex-end;background:none}
.card{background:#fff;border-radius:24px;padding:16px 20px;text-align:center;max-width:380px;width:100%;max-height:100%;overflow:hidden;
  display:flex;flex-direction:column;align-items:center;gap:8px;box-shadow:0 6px 24px rgba(60,20,90,.3)}
.card h1{margin:0;font-size:26px;color:#e0447f}
.card h2{margin:0;font-size:20px}
.card p{margin:0;line-height:1.35}
.card .rowb{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.photo{position:relative;flex:0 1 auto;min-height:0}
.photo .fin{height:min(46vh,340px);aspect-ratio:6/7;border-radius:16px;display:block}
.photo .bef{position:absolute;left:-10px;bottom:-6px;width:30%;border:4px solid #fff;border-bottom-width:14px;border-radius:4px;
  transform:rotate(-7deg);box-shadow:0 2px 8px rgba(0,0,0,.3)}
.photo small{position:absolute;left:0;bottom:-6px;width:30%;transform:rotate(-7deg);font-size:10px;font-weight:700}
.tags{color:#7a4fc4;font-size:13px}

/* short landscape: dock the tray on the right so the client keeps the full height */
@media (orientation:landscape) and (max-height:560px){
  #tray{left:auto;top:0;width:46%;border-radius:22px 0 0 22px;justify-content:center;padding:10px}
  #hud{right:46%}
  #toast{left:27%}
  #prev,#nxt{display:none}
  #car{flex-wrap:wrap;overflow:hidden auto;max-height:62vh;justify-content:center}
  .it{flex-basis:64px;height:64px}
}
