:root{
  --red:#DB0525; --red-deep:#A10320; --wine:#4A0714; --wine-2:#65101F; --ink:#1C0408;
  --cream:#FFF3E6; --orange:#FF8A1F; --lemon:#F5D93A; --ok:#4CD07D; --soft:#F6B3BD;
  --page:#DB0525;
  --font:"Press Start 2P", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--page:#5E0212;}}
:root[data-theme="dark"]{--page:#5E0212;}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{background:var(--page);color:var(--cream);font-family:var(--font);overflow:hidden;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-text-size-adjust:100%}
#app{position:relative;margin:0 auto;max-width:460px;height:100vh;height:100dvh;background:var(--ink);overflow:hidden}
.screen{position:absolute;inset:0;display:flex;flex-direction:column}
.screen[hidden]{display:none}
button{font-family:var(--font);cursor:pointer;color:inherit}
button:focus-visible,input:focus-visible{outline:3px solid var(--orange);outline-offset:2px}
p{margin:0}

.px{font-size:9px;line-height:1.35;color:var(--cream);background:var(--wine-2);border:0;border-radius:0;padding:9px 6px;box-shadow:inset -3px -3px 0 rgba(0,0,0,.35),inset 3px 3px 0 rgba(255,255,255,.1),0 0 0 2px var(--ink)}
.px:active{transform:translateY(1px)}
.px[aria-pressed="true"]{background:var(--orange);color:var(--ink)}
.px:disabled{opacity:.4;cursor:default;transform:none}
.px.primary{background:var(--red);font-size:11px;padding:13px 10px}
.px.ghost{background:transparent;box-shadow:inset 0 0 0 2px rgba(255,243,230,.35)}

/* splash */
#splash{background:var(--red);align-items:center;justify-content:center}
#splashCv{width:min(86vw,380px);height:min(86vw,380px)}
#splashCap{position:absolute;left:0;right:0;bottom:22%;text-align:center;font-size:10px;letter-spacing:2px;opacity:0;transition:opacity .25s steps(3)}
#splashSkip{position:absolute;left:0;right:0;bottom:calc(24px + env(safe-area-inset-bottom));text-align:center;font-size:7px;opacity:.65}

/* auth + menu */
/* telas de acesso: centraliza sem cortar o topo quando o teclado abre */
.form-screen{background:var(--red);align-items:center;justify-content:flex-start;gap:16px;padding:24px 18px calc(24px + env(safe-area-inset-bottom));overflow-y:auto}
.form-screen > :first-child{margin-top:auto}
.form-screen > :last-child{margin-bottom:auto}
.stack{display:flex;flex-direction:column;gap:12px}
#signup .nw{width:min(44vw,180px)}
#signup .urb{width:36px;height:35px}
.brand{display:flex;flex-direction:column;align-items:center;gap:12px}
.brand .row{display:flex;align-items:center;gap:14px}
.urb{display:block;width:46px;height:45px;color:#fff}
.urb svg{width:100%;height:100%;display:block}
.nw{width:min(62vw,250px);height:auto;display:block}
.title{font-size:11px;line-height:1.7;letter-spacing:1px;text-align:center;text-shadow:3px 3px 0 var(--ink)}
.card{width:100%;max-width:340px;background:var(--wine);padding:16px;box-shadow:0 0 0 3px var(--ink),6px 6px 0 var(--ink);display:flex;flex-direction:column;gap:12px}
.field{display:flex;flex-direction:column;gap:7px;font-size:8px;color:var(--soft)}
.field input{font-family:var(--font);font-size:16px;padding:11px 10px;background:var(--ink);color:var(--cream);border:0;border-radius:0;box-shadow:inset 0 0 0 2px #8a1a2c;width:100%;-webkit-user-select:text;user-select:text}
.msg{font-size:8px;min-height:1.5em;line-height:1.6;color:#FFD09A}
.msg.bad{color:#FFB0A0}
.note{font-size:7px;line-height:1.8;color:var(--soft)}
.hello{font-size:11px;line-height:1.6}
.best{font-size:8px;line-height:1.7;color:var(--soft)}
.two{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.rank{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;font-size:8px}
.rank li{display:grid;grid-template-columns:22px 1fr auto;gap:6px;align-items:center;background:var(--ink);padding:8px}
.rank li.me{box-shadow:inset 0 0 0 2px var(--orange)}
.rank .pos{color:var(--orange)}
.rank .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rank .sc{color:var(--ok)}
.rank .empty{display:block;text-align:center;color:var(--soft);line-height:1.7}

/* game */
#game{background:var(--ink)}
.hud{display:flex;align-items:center;gap:8px;padding:7px 8px;padding-top:max(7px,env(safe-area-inset-top));background:var(--red);font-size:9px;box-shadow:0 3px 0 var(--ink);position:relative;z-index:2}
.hud .grow{flex:1}
.hud .money{padding:3px 4px}
.hud .money.done{background:var(--ink);color:var(--ok)}
.hud .time.low{color:var(--lemon)}
.hearts{display:flex;gap:2px}
.hearts img{width:14px;height:12px;image-rendering:pixelated}
.hearts img.off{opacity:.25}
.hud .px{padding:6px 6px;font-size:8px}
.icon-btn img{width:14px;height:14px;image-rendering:pixelated;display:block}
.hud .book{display:flex;align-items:center;gap:6px}
.hud .book img{width:14px;height:12px}
@media (max-width:389px){.hud .book span{display:none}.hud{font-size:8px;gap:6px}}
.scene{flex:1 1 auto;min-height:110px;display:flex;align-items:flex-end;justify-content:center;background:#2E040C;overflow:hidden}
#sceneCv{display:block;image-rendering:pixelated;touch-action:manipulation}
.panel{flex:0 0 auto;background:var(--wine);padding:8px 8px calc(8px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:7px;box-shadow:0 -3px 0 var(--ink)}
.ticket{display:flex;align-items:center;gap:8px;background:var(--ink);padding:7px 8px;min-height:32px;border:0;width:100%;text-align:left}
.ticket .lbl{font-size:7px;color:var(--soft)}
.ticket .name{font-size:10px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ticket .bar{width:54px;height:7px;background:#3a0a14;flex:0 0 auto}
.ticket .bar i{display:block;height:100%;width:0}
.glasses{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.ings{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}
.tile{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:3px;padding:5px 2px;font-size:7px;min-width:0}
.tile img{image-rendering:pixelated;width:22px;height:22px;display:block}
.glasses .tile{flex-direction:row;justify-content:center;gap:6px;padding:6px 2px}
.glasses .tile img{width:15px;height:20px}
.ings .tile span{min-height:2.7em;display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.35;word-break:break-word}
.prep{display:grid;grid-template-columns:1fr 1fr 1fr 4px 1.25fr 1.25fr;gap:5px}
.prep .px{font-size:7px;padding:9px 2px;display:flex;align-items:center;justify-content:center;gap:4px}
.prep .px img{width:12px;height:12px;image-rendering:pixelated}
.bottom{display:grid;grid-template-columns:48px 1fr 96px;gap:8px;align-items:center}
#previewCv{width:48px;height:64px;image-rendering:pixelated;background:var(--ink);display:block}
.contents{font-size:7px;line-height:1.7;color:var(--soft);min-width:0;display:flex;flex-direction:column;gap:3px}
.contents .hint{color:var(--cream);font-size:8px;line-height:1.5}
.contents .hint.warn{color:#FFB0A0}
.contents .hint.good{color:var(--ok)}
.contents .hint.go{color:var(--orange)}
.actions{display:flex;flex-direction:column;gap:6px}
.actions .px{padding:10px 4px}
#serveBtn:not(:disabled){animation:pulse 1s steps(2) infinite}
@keyframes pulse{50%{background:var(--orange);color:var(--ink)}}
@media (max-width:359px){.tile,.prep .px{font-size:6px}.hud{font-size:8px;gap:5px}}
@media (prefers-reduced-motion: reduce){#serveBtn:not(:disabled){animation:none}}

/* modal */
.modal{position:absolute;inset:0;background:rgba(28,4,8,.74);display:flex;align-items:flex-end;justify-content:center;z-index:20}
.modal[hidden]{display:none}
.sheet{width:100%;max-height:92%;background:var(--wine);box-shadow:0 -3px 0 var(--ink),0 -6px 0 var(--red);display:flex;flex-direction:column;min-height:0}
.mhead{flex:0 0 auto;padding:18px 16px 14px;display:flex;flex-direction:column;gap:10px;background:var(--wine);box-shadow:0 3px 0 var(--ink);position:relative;z-index:1}
.mhead h2{margin:0;font-size:16px;line-height:1.4;text-align:center;text-shadow:3px 3px 0 var(--ink);font-weight:400}
.msub{font-size:9px;line-height:1.9;text-align:center}
.msub[hidden],.mtop[hidden],.mactions[hidden]{display:none}
.msub .dim{color:var(--soft)} .msub .or{color:var(--orange)}
.mtop{display:flex;flex-direction:column;gap:8px}
.mscroll{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:16px 16px calc(16px + env(safe-area-inset-bottom))}
.mbody{font-size:9px;line-height:1.9;text-align:center;display:flex;flex-direction:column;gap:6px}
.mbody .big{font-size:18px;line-height:1.4}
.mbody .ok{color:var(--ok)} .mbody .bad{color:#FFB0A0} .mbody .or{color:var(--orange)} .mbody .dim{color:var(--soft)}
.mbody .lead{font-size:8px;line-height:1.9;color:var(--soft);text-align:left;margin-bottom:6px}
.mactions{flex:0 0 auto;display:flex;flex-direction:column;gap:9px;padding:14px 16px calc(16px + env(safe-area-inset-bottom));box-shadow:0 -3px 0 var(--ink)}
.recipe .tag{font-style:normal;font-size:7px;background:var(--red);color:var(--cream);padding:3px 4px;margin-left:6px;vertical-align:middle}
.legal{font-size:7px;line-height:1.8;text-align:center;opacity:.85;max-width:340px}
.recipes{display:flex;flex-direction:column;gap:8px;text-align:left}
.recipe{background:var(--ink);padding:10px;display:flex;flex-direction:column;gap:6px;font-size:8px;line-height:1.6}
.recipe .rn{display:flex;justify-content:space-between;gap:8px;font-size:10px;color:var(--orange)}
.recipe .rn span:last-child{color:var(--ok);font-size:8px}
.recipe .how{color:#9fd6ff}
.recipe .spec{color:var(--cream)}
.recipe .story{color:var(--soft);font-size:7px;line-height:1.8}
.recipe.locked{opacity:.5}

/* prêmio */
.negroni-art{display:block;width:200px;height:200px;margin:0 auto;image-rendering:pixelated}

/* tutorial */
.tut{position:absolute;inset:0;z-index:30}
.tut[hidden]{display:none}
.tut-hole{position:absolute;box-shadow:0 0 0 9999px rgba(28,4,8,.8);outline:3px solid var(--orange);pointer-events:none;transition:top .18s steps(3),left .18s steps(3),width .18s steps(3),height .18s steps(3)}
.tut-card{position:absolute;left:12px;right:12px;background:var(--wine);box-shadow:0 0 0 3px var(--ink),5px 5px 0 var(--ink);padding:14px;display:flex;flex-direction:column;gap:10px}
.tut-step{font-size:8px;color:var(--orange)}
.tut-text{font-size:9px;line-height:1.8}
@media (prefers-reduced-motion: reduce){.tut-hole{transition:none}}
