/* Metabolle game screen */
:root{--enz:light-dark(#c2600a,#f5a524);--atp:light-dark(#6a3dc2,#b99bff);--redox:light-dark(#1b6ad6,#6fb0ff);
--inh:light-dark(#c62828,#ff6b6b);--act:light-dark(#1d8048,#5fd18f);--slot:light-dark(#f7f5f0,#25242a)}
body.playing>header,body.playing>main{display:none}
#game{display:none;height:100vh;grid-template-rows:auto minmax(0,1fr)}
body.playing #game{display:grid}
.gbar{display:flex;align-items:center;gap:14px;padding:10px 18px;border-bottom:1px solid var(--line);background:var(--top);flex-wrap:wrap}
.gbar h2{font-family:Newsreader,Georgia,serif;font-style:italic;font-weight:400;font-size:28px;margin:0 auto 0 4px;line-height:1.1}
.gbar .pill{border:1px solid var(--line);border-radius:999px;padding:6px 14px;font-size:15px;color:var(--soft);white-space:nowrap}
.gbar .pill b{color:var(--ink);font-variant-numeric:tabular-nums}
.gbtn{border:1px solid var(--line);background:var(--card);border-radius:999px;padding:8px 16px;min-height:40px;cursor:pointer;font-size:15px}
.gbtn:hover{border-color:var(--acc)}
.gbody{display:grid;grid-template-columns:minmax(0,1fr) 280px;min-height:0}
.board{position:relative;padding:8px;min-height:0;display:flex}
.board svg{width:100%;height:100%;display:block;user-select:none;-webkit-user-select:none}
.tray{position:relative;border-left:1px solid var(--line);background:var(--top);display:flex;flex-direction:column;min-height:0}
.tray .th{padding:16px 18px 10px}
.tray .th p{margin:0;font-size:13px;color:var(--soft)}
.tray .th h3{margin:2px 0 0;font-family:Newsreader,Georgia,serif;font-style:italic;font-weight:400;font-size:22px;line-height:1.2}
.tray .tip{margin:0;padding:0 18px 8px;font-size:13px;line-height:1.4;color:var(--soft)}
.tray .tip:empty{display:none}
.chips{flex:1;overflow-y:auto;padding:6px 14px 20px;display:flex;flex-wrap:wrap;gap:8px;align-content:flex-start;align-items:center}
.chip{border:1px solid var(--line);background:var(--card);border-radius:10px;padding:7px 12px;min-height:38px;font-size:14px;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;color:var(--ink);transition:transform .12s,box-shadow .12s,opacity .15s}
.chip:hover{border-color:var(--acc);box-shadow:0 4px 12px -6px rgb(0 0 0/.3)}
.chip.st{padding:4px;width:136px;height:88px}
.chip.st svg{width:100%;height:100%;display:block;pointer-events:none}
.chip.sel{border-color:var(--acc);box-shadow:0 0 0 3px var(--accbg);transform:translateY(-2px)}
.chip.lift{opacity:.25}
.chip.shake{animation:shake .35s}
@keyframes shake{25%{transform:translateX(-6px)}50%{transform:translateX(6px)}75%{transform:translateX(-3px)}}
.ghost{position:fixed;left:0;top:0;z-index:50;pointer-events:none;margin:0;box-shadow:0 10px 24px -8px rgb(0 0 0/.4);border-color:var(--acc)!important;transition:none!important;animation:none!important;will-change:transform}
/* board svg */
.bx{fill:var(--card);stroke:var(--ink);stroke-width:1.6}
.dv{stroke:var(--ink);stroke-width:1.2}
.x2{fill:none;stroke:var(--soft);stroke-width:1.4;stroke-dasharray:6 5}
.note{fill:var(--inh);font-style:italic}
.note2,.ttl{fill:var(--soft);font-style:italic}
.ttl{fill:var(--ink)}
.ar{stroke:var(--ink);stroke-width:1.6;fill:none}
.irr{stroke:var(--inh);stroke-width:7;fill:none}
.cv{stroke:var(--soft);stroke-width:1.3;fill:none}
.fx text{fill:var(--ink);font-family:Lato,system-ui,sans-serif}
.fx line{stroke:var(--ink);stroke-width:1.3}
.slot>rect{fill:var(--slot);stroke:var(--soft);stroke-width:1.2;stroke-dasharray:4 3;transition:fill .15s,stroke .15s}
.slot{cursor:pointer;outline:none}
.slot:focus-visible>rect,.slot.hov>rect{stroke:var(--acc);stroke-dasharray:none;stroke-width:2;fill:var(--accbg)}
.slot.bad>rect{stroke:var(--inh);stroke-dasharray:none;stroke-width:2;fill:rgb(220 50 50/.14)}
.slot.typing>rect{stroke:var(--acc);stroke-dasharray:none;stroke-width:2;fill:var(--accbg)}
.slot.full>rect{fill:transparent;stroke:none}
.slot.shown>g{opacity:.6} /* filled in with Show answer */
.slot.full{cursor:default}
.slot.later{opacity:.3;pointer-events:none}
.slot.pop>g{animation:pop .3s}
@keyframes pop{from{opacity:0;transform:scale(.9)}}
.slot>g{transform-box:fill-box;transform-origin:center}
.ft{font-family:Newsreader,Georgia,serif;font-style:italic}
.ft.mol,.ft.yield{fill:var(--ink)}.ft.yield{font-style:normal;font-family:Lato,system-ui,sans-serif;font-weight:700}
.ft.enz{fill:var(--enz)}.ft.atp{fill:var(--atp)}.ft.redox{fill:var(--redox)}.ft.inh{fill:var(--inh)}.ft.act{fill:var(--act)}
.ft.atp,.ft.redox,.ft.inh,.ft.act{font-style:normal;font-family:Lato,system-ui,sans-serif;font-weight:700}
.sg{font:700 13px Lato,system-ui,sans-serif;fill:#fff}
.sgc.inh{fill:var(--inh)}.sgc.act{fill:var(--act)}
/* Fill in the Blank: the answer box that opens over a blank */
/* the blank being typed in becomes a plain text field of exactly its size: transparent, so the highlighted blank shows through */
.typer{position:absolute;z-index:6;box-sizing:border-box;margin:0;padding:0 4px;border:0;outline:0;background:transparent;color:var(--ink);font-family:Lato,system-ui,sans-serif;text-align:center}
.typer[hidden]{display:none}
.slot.typing.bad>rect{stroke:var(--inh);fill:rgb(220 50 50/.14)}
.slot.near>rect{stroke:light-dark(#b88a00,#f2c94c);stroke-dasharray:none;stroke-width:2;fill:rgb(240 190 40/.18)} /* right name, number missing */
/* top-left corner of the diagram: the hint, and Show answer after 2 wrong tries on the open blank */
.thelp{position:absolute;z-index:6;display:flex;align-items:center;gap:8px;white-space:nowrap;pointer-events:none}
.thelp[hidden]{display:none}
.thelp button{pointer-events:auto;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:999px;padding:6px 14px;font:14px Lato,system-ui,sans-serif;cursor:pointer;box-shadow:0 4px 12px -6px rgb(0 0 0/.3);animation:pop .3s}
.thelp button:hover{border-color:var(--acc)}
.thelp button[hidden]{display:none}
.tmsg{background:var(--ink);color:var(--top);font-size:13px;padding:5px 12px;border-radius:999px;opacity:0;transition:opacity .2s}
.tmsg.on{opacity:1}
/* stage toast + results */
/* round toast sits over the top of the tray (where the new labels appear), never over the board's blanks */
.toast{position:absolute;top:10px;left:12px;right:12px;transform:translateY(-8px);background:var(--ink);color:var(--top);padding:10px 14px;border-radius:12px;font-size:15px;line-height:1.35;text-align:center;opacity:0;transition:opacity .25s,transform .25s;z-index:5;pointer-events:none}
.toast.on{opacity:1;transform:none}
.res{position:fixed;inset:0;background:rgb(20 18 15/.5);backdrop-filter:blur(3px);display:none;place-items:center;z-index:45;padding:16px}
.res.on{display:grid}
.res>div{background:var(--card);border-radius:20px;padding:34px clamp(20px,4vw,40px);width:min(520px,94vw);text-align:center;box-shadow:0 30px 80px -20px rgb(0 0 0/.45)}
.res h3{font-family:Newsreader,Georgia,serif;font-style:italic;font-weight:400;font-size:40px;margin:0 0 6px;line-height:1.05}
.res .sub{color:var(--soft);margin:0 0 20px}
.res .nums{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:18px}
.res .nums div{background:var(--mute);border-radius:12px;padding:12px 6px}
.res .nums b{display:block;font-size:26px;font-variant-numeric:tabular-nums}
.res .nums span{font-size:13px;color:var(--soft)}
.share{display:flex;gap:8px;align-items:center;background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:8px 8px 8px 14px;text-align:left;margin-bottom:18px}
.share code{flex:1;font:14px/1.4 Lato,system-ui,sans-serif;overflow-wrap:anywhere}
.res .row{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.res .go{display:inline-block;width:auto;padding:0 26px;margin:0}
@media(max-width:900px){.gbody{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) 230px}.tray{border-left:0;border-top:1px solid var(--line)}.chips{flex-wrap:wrap}}
