@font-face{font-family:"UpsHebrew";src:url(hebrew.woff2) format("woff2");font-weight:300 900;font-display:swap;unicode-range:U+0590-05FF,U+FB1D-FB4F}
:root{--top:64px;--tray:100px;--panel:min(36vh,300px);--ink:#2b2340;--accent:#ff8a3d;--sea:#2f6f8f}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#fbefdc;font-family:"Nunito","Varela Round","Trebuchet MS",system-ui,sans-serif;color:var(--ink);touch-action:none;user-select:none;-webkit-user-select:none;overscroll-behavior:none}
#app{position:fixed;inset:0}
#stage{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
button{font:inherit;color:inherit;border:0;cursor:pointer;touch-action:manipulation}
button:focus-visible{outline:4px solid #ffcf3d;outline-offset:3px}
.he{font-family:"UpsHebrew","Frank Ruhl Libre","David","Noto Sans Hebrew","Arial Hebrew",serif}

#topbar{position:absolute;left:0;right:0;top:0;height:var(--top);display:flex;align-items:center;justify-content:space-between;padding:8px max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left));pointer-events:none;z-index:5}
#topbar>*{pointer-events:auto}
.round{width:52px;height:52px;border-radius:50%;background:#fff;box-shadow:0 3px 0 #e3cfae,0 6px 14px rgba(70,40,10,.15);font-size:26px;display:grid;place-items:center}
.round:active{transform:translateY(2px);box-shadow:0 1px 0 #e3cfae}
#steps{display:flex;gap:6px;background:rgba(255,255,255,.75);padding:5px 8px;border-radius:30px;box-shadow:0 4px 12px rgba(70,40,10,.12)}
#steps button{width:44px;height:44px;border-radius:50%;background:#f3e6cf;padding:0;display:grid;place-items:center;transition:transform .15s}
#steps button canvas{width:38px;height:38px}
#steps button.on{background:#ffd56b;transform:scale(1.12);box-shadow:0 0 0 3px #fff}
#steps button.did{background:#c9ecd6}
body.pick #steps{visibility:hidden}

#picker{position:absolute;inset:0;padding:calc(var(--top) + 4px) 14px 18px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;z-index:4;background:radial-gradient(circle at 50% 30%,#fff7e6 0,#fde4bf 60%,#f7cf9a 100%)}
#picker h1{margin:0;font-size:clamp(26px,7vw,44px);text-align:center;color:#3b2a59;line-height:1.1}
#picker h1 .he{display:block;font-size:.8em;color:#b5562b}
#picker .sub{margin:2px 0 10px;font-size:clamp(15px,4vw,20px);color:#6a5878}
#kids{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:min(100%,560px)}
.kid{background:#fff;border-radius:26px;padding:6px 6px 10px;box-shadow:0 5px 0 #e8c99a,0 10px 22px rgba(90,50,10,.15);display:flex;flex-direction:column;align-items:center;animation:bob 2.6s ease-in-out infinite}
.kid:nth-child(2){animation-delay:-.6s}.kid:nth-child(3){animation-delay:-1.3s}.kid:nth-child(4){animation-delay:-1.9s}
.kid:active{transform:scale(.96)}
.kid canvas{width:100%;aspect-ratio:1/1;height:auto;max-height:26vh;object-fit:contain}
.kid b{font-size:clamp(18px,5vw,24px);line-height:1}
.kid b .he{font-weight:600;color:#b5562b;margin-left:6px}
.kid small{font-size:13px;color:#8a7a92;margin-top:2px;letter-spacing:.02em}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
body:not(.pick) #picker{display:none}

#tray{position:absolute;left:0;right:0;bottom:0;height:var(--tray);display:none;gap:8px;align-items:center;justify-content:center;padding:8px 10px max(8px,env(safe-area-inset-bottom));background:linear-gradient(#fff0,#fff8 30%);z-index:3}
body.wash #tray,body.cut #tray{display:flex}
.tool{width:min(76px,17vw);height:min(76px,17vw);flex:0 0 auto;border-radius:24px;background:#fff;box-shadow:0 4px 0 #e2c9a3,0 8px 16px rgba(80,40,10,.15);display:grid;place-items:center;padding:0;transition:transform .15s}
.tool canvas{width:84%;height:84%}
.tool.on{background:#ffe08a;transform:translateY(-8px) scale(1.06);box-shadow:0 4px 0 #e0a92e,0 10px 20px rgba(80,40,10,.25)}

#stylePanel{position:absolute;left:0;right:0;bottom:0;height:var(--panel);display:none;flex-direction:column;background:#fff;border-radius:28px 28px 0 0;box-shadow:0 -6px 24px rgba(70,40,10,.18);padding:10px 10px max(10px,env(safe-area-inset-bottom));z-index:3}
body.style #stylePanel{display:flex}
#tabs{display:flex;gap:8px;justify-content:center;margin-bottom:8px}
#tabs button{width:62px;height:54px;border-radius:18px;background:#f4ead8;display:grid;place-items:center;padding:0}
#tabs button canvas{width:46px;height:46px}
#tabs button[aria-selected=true]{background:#ffd56b;box-shadow:0 3px 0 #e0a92e}
#options{flex:1;align-items:flex-start;scrollbar-width:none;overflow-x:auto;overflow-y:hidden;display:flex;gap:10px;padding:4px 4px 8px;touch-action:pan-x;scroll-snap-type:x proximity}
.opt{flex:0 0 auto;width:118px;border-radius:20px;background:#fbf4e7;padding:6px 6px 8px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;scroll-snap-align:start;border:3px solid transparent}
.opt canvas{width:84px;height:84px}
.opt b{font-size:15px;line-height:1.1;text-align:center}
.opt small{font-size:12px;line-height:1.15;color:#7a6a80;text-align:center}
.opt .tag{font-size:10.5px;color:#fff;background:#8a7aa8;border-radius:8px;padding:1px 6px;margin-top:2px}
.opt .tag.ch{background:#3c3c5c}.opt .tag.li{background:#3f7d9a}
.opt.on{border-color:#ff9d2e;background:#fff3d6}
.opt.sw{width:64px}
.swatches{display:flex;gap:8px;align-items:center;padding:0 6px}
.swatch{width:46px;height:46px;border-radius:50%;border:4px solid #fff;box-shadow:0 0 0 2px #ddd;flex:0 0 auto}
.swatch.on{box-shadow:0 0 0 4px #ff9d2e}

#finale{position:absolute;left:0;right:0;bottom:0;display:none;flex-direction:column;align-items:center;background:#fff;border-radius:28px 28px 0 0;box-shadow:0 -6px 24px rgba(70,40,10,.18);padding:8px 12px max(12px,env(safe-area-inset-bottom));z-index:3}
body.done #finale{display:flex}
#finale h2{margin:0 0 6px;font-size:clamp(28px,8vw,40px);color:#d14b2a;text-shadow:0 2px 0 #ffd56b;display:flex;gap:12px;align-items:baseline}
#finale h2 .he{color:#3b2a59;font-size:.8em}
.frow{display:flex;gap:14px;align-items:center;justify-content:center}
#photoBtn{position:relative;padding:5px;background:#f3d27a;border-radius:14px;box-shadow:0 4px 0 #d3a63a}
#photo{display:block;width:96px;height:120px;border-radius:9px;object-fit:cover;background:#fff}
#photoBtn .save{position:absolute;left:50%;bottom:-12px;transform:translateX(-50%);background:#2f6f8f;color:#fff;font-size:14px;font-weight:800;border-radius:14px;padding:3px 10px;white-space:nowrap}
.treats{display:grid;grid-template-columns:auto auto;gap:10px;align-items:center}
.honey{grid-column:1/3;display:flex;gap:8px;background:#fff1cf;border-radius:16px;padding:6px 8px}
.honey button{width:48px;height:48px;border-radius:12px;background:linear-gradient(#ffcf57,#e39a17);color:#7a3e00;font-size:30px;font-weight:700;font-family:"UpsHebrew","Frank Ruhl Libre","David",serif;box-shadow:inset 0 -4px 0 #c9790a,0 3px 6px rgba(120,60,0,.25)}
.honey button.licked{filter:brightness(1.15);transform:scale(1.1)}
.treat{width:58px;height:58px;border-radius:50%;background:#fbf4e7;font-size:30px;box-shadow:0 3px 0 #e2c9a3}

#nextBtn{position:absolute;right:max(14px,env(safe-area-inset-right));bottom:calc(var(--tray) + 12px);width:66px;height:66px;border-radius:50%;background:#3fb37f;color:#fff;font-size:34px;font-weight:900;box-shadow:0 5px 0 #2a8a5f,0 10px 18px rgba(0,60,30,.25);display:none;z-index:6;animation:pulse 1.6s ease-in-out infinite}
body.wash #nextBtn,body.cut #nextBtn,body.style #nextBtn{display:block}
body.style #nextBtn{bottom:calc(var(--panel) + 12px)}
#nextBtn.ready{background:#ff8a3d;box-shadow:0 5px 0 #c9631f,0 10px 18px rgba(120,40,0,.25)}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}

@media (orientation:landscape) and (max-height:600px){
  :root{--top:56px;--tray:92px}
  .round{width:46px;height:46px;font-size:22px}
  #tray{top:var(--top);bottom:0;left:0;right:auto;width:var(--tray);height:auto;flex-direction:column;justify-content:center;background:linear-gradient(90deg,#fff8,#fff0);padding:6px}
  .tool{width:min(64px,calc((100vh - 96px) / 5.5));height:min(64px,calc((100vh - 96px) / 5.5));border-radius:18px}#tray{gap:6px}
  .tool.on{transform:translateX(6px) scale(1.06)}
  #stylePanel,#finale{top:var(--top);bottom:0;left:auto;right:0;width:46vw;height:auto;border-radius:28px 0 0 28px}
  #nextBtn,body.style #nextBtn{bottom:14px;right:calc(46vw + 14px)}
  body.wash #nextBtn,body.cut #nextBtn{right:14px;bottom:14px}
  #options{flex-wrap:wrap;overflow-y:auto;overflow-x:hidden;touch-action:pan-y;align-content:flex-start;justify-content:center}
  .opt{width:104px}.opt canvas{width:64px;height:64px}
  #finale h2{font-size:28px}
  #picker{flex-direction:column;justify-content:flex-start;padding-top:calc(var(--top) - 44px)}
  #picker h1{font-size:26px}#picker h1 .he{display:inline;margin-right:8px}
  #picker .sub{margin:0 0 6px;font-size:14px}
  #kids{grid-template-columns:repeat(4,minmax(0,1fr));width:min(100%,820px)}
  .kid canvas{max-height:52vh}
}
@media (min-width:700px) and (min-height:700px){
  :root{--tray:118px;--panel:34vh}
  .tool{width:96px;height:96px}.tool canvas{width:80px;height:80px}
  #kids{grid-template-columns:repeat(4,minmax(0,1fr));width:min(100%,900px)}
  .opt{width:140px}.opt canvas{width:100px;height:100px}
}
@media (prefers-reduced-motion:reduce){.kid,#nextBtn{animation:none}}

#options::-webkit-scrollbar{display:none}

/* v2: hair colour on the picker, kapel colours */
#hairRow{margin-top:12px;flex-wrap:wrap;justify-content:center;gap:8px;max-width:560px}
#hairRow::before{content:"🎨";font-size:26px;margin-right:2px}
#hairRow .swatch{width:40px;height:40px}
.swatch.own{background:conic-gradient(#1f1a16 0 16%,#3e2818 0 33%,#8a5d38 0 50%,#d2aa62 0 66%,#c0582b 0 83%,#7c3322 0)}
#options .swatches{flex-wrap:nowrap}
@media (max-height:500px) and (orientation:landscape){#hairRow{margin-top:6px}#hairRow .swatch{width:34px;height:34px}}

.tool{position:relative}
.tool .tag{position:absolute;bottom:3px;left:50%;transform:translateX(-50%);font:700 10px/1 system-ui,sans-serif;color:#fff;background:#3b4157;border-radius:8px;padding:2px 5px;letter-spacing:.3px;pointer-events:none}

/* v2.3: big Hebrew Mazel Tov */
#finale h2{flex-direction:column;align-items:center;gap:0;line-height:1}
#finale h2 .mt-he{font-size:clamp(46px,14vw,66px);font-weight:900;color:#d14b2a;text-shadow:0 3px 0 #ffd56b,0 0 2px #fff;animation:mtpop .7s cubic-bezier(.2,1.6,.4,1) both}
#finale h2 .mt-en{font-size:.55em;color:#3b2a59;text-shadow:none;margin-top:2px}
#mtBurst{position:absolute;left:0;right:0;top:39%;z-index:6;pointer-events:none;text-align:center;animation:mtpop .8s cubic-bezier(.2,1.6,.4,1) both;transition:opacity .6s,transform .6s}
#mtBurst.out{opacity:0;transform:translateY(-30px) scale(.9)}
#mtBurst .mt-he{font-size:clamp(60px,min(24vw,26vh),150px);font-weight:900;line-height:1.05;color:#ffcf3f;-webkit-text-stroke:3px #c2410c;text-shadow:0 6px 0 #c2410c,0 10px 24px rgba(120,40,0,.45)}
#mtBurst .mt-en{font:800 clamp(22px,6vw,34px) "Nunito","Trebuchet MS",sans-serif;color:#fff;text-shadow:0 2px 0 #c2410c,0 4px 12px rgba(0,0,0,.35)}
@keyframes mtpop{0%{transform:scale(.3) rotate(-6deg);opacity:0}100%{transform:none;opacity:1}}
.honey{direction:rtl}
.honey button{font-family:"UpsHebrew","Frank Ruhl Libre","David","Noto Sans Hebrew",serif}
@media (orientation:landscape) and (max-height:600px){body.done #mtBurst,body.style #mtBurst{right:46vw;top:46%}}

/* v2.4: the tzitzis tab has exactly 4 options: show all 4 at once on a phone */
#options.four{gap:6px}
#options.four .opt{flex:1 1 0;min-width:0;width:auto;max-width:140px;padding:5px 3px 7px}
#options.four .opt canvas{width:min(76px,100%);height:auto;aspect-ratio:1}
#options.four .opt b{font-size:13.5px}
#options.four .opt small{font-size:11px}
/* v2.4 song picker */
.songs{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:8px auto 0}
.songs .song{display:flex;align-items:center;gap:6px;border:3px solid transparent;border-radius:18px;background:#fbf4e7;padding:5px 12px 5px 9px;font:inherit;color:#3b2a59;box-shadow:0 2px 6px rgba(40,20,60,.15)}
.songs .song .he{font-family:"UpsHebrew","Frank Ruhl Libre","David","Noto Sans Hebrew",serif;font-weight:900;font-size:17px;line-height:1}
.songs .song small{font-size:11.5px;color:#7a6a80}
.songs .song .note{font-size:15px}
.songs .song.on{border-color:#ff9d2e;background:#fff3d6}
#finale .songs{margin:2px auto 6px}

/* v2.5: "!כמעט" nudge: מזל טוב only after a kapel and tzitzis */
#almost{position:absolute;left:0;right:0;margin:0 auto;width:max-content;max-width:88vw;top:30%;z-index:7;background:#fffaf0;border-radius:26px;padding:14px 22px 16px;text-align:center;box-shadow:0 10px 30px rgba(60,30,0,.28),0 0 0 4px #ffd56b;animation:mtpop .5s cubic-bezier(.2,1.6,.4,1) both;transition:opacity .5s;min-width:min(78vw,320px);cursor:pointer}
#almost.out{opacity:0}
#almost .al-he{font-size:clamp(40px,12vw,58px);font-weight:900;line-height:1;color:#d14b2a;text-shadow:0 3px 0 #ffd56b}
#almost .al-en{font:800 clamp(17px,4.6vw,22px) "Nunito","Trebuchet MS",sans-serif;color:#3b2a59;margin-top:4px}
#almost .al-he2{font-size:clamp(20px,5.4vw,26px);font-weight:700;color:#7a4a1c;margin-top:2px}
#almost .al-icons{display:flex;align-items:center;justify-content:center;gap:10px;margin-top:10px}
#almost .al-plus{font:900 28px "Nunito",sans-serif;color:#b5562b}
#almost .al-ic{position:relative;width:64px;height:64px;border-radius:18px;background:#f4ead8;display:grid;place-items:center}
#almost .al-ic canvas{width:52px;height:52px}
#almost .al-ic.need{background:#ffe08a;box-shadow:0 0 0 3px #f59e0b;animation:needPulse 1s ease-in-out infinite}
#almost .al-ic i{position:absolute;right:-6px;top:-6px;width:24px;height:24px;border-radius:50%;font:900 15px/24px "Nunito",sans-serif;font-style:normal;color:#fff;background:#e0567a}
#almost .al-ic.ok i{background:#3fb37f}
#tabs button.need{background:#ffe08a;box-shadow:0 0 0 3px #f59e0b;animation:needPulse 1s ease-in-out infinite;position:relative}
#tabs button.need::after{content:"!";position:absolute;right:-5px;top:-5px;width:20px;height:20px;border-radius:50%;background:#e0567a;color:#fff;font:900 13px/20px "Nunito",sans-serif}
@keyframes needPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}
@media (orientation:landscape) and (max-height:600px){#almost{right:46vw;top:16%}}
