.mw{--paper:#f1e4c8;--ink:#2a1b12;--soil:#8a5a36;--gold:#f2b632;--green:#5d9c3f;--red:#d04a30;
  background:var(--paper);color:var(--ink);border:3px solid var(--ink);border-radius:18px;padding:.6rem;
  font-family:ui-rounded,"Trebuchet MS",system-ui,sans-serif;box-shadow:0 5px 0 var(--ink);position:relative;
  -webkit-user-select:none;user-select:none}
.mw *{box-sizing:border-box}
.mw-hud{display:flex;gap:.6rem;align-items:center}
.mw-chip{background:var(--ink);color:var(--paper);border-radius:10px;padding:.35rem .6rem;font-weight:800;font-size:.85rem;white-space:nowrap}
.mw-energy{flex:1;min-width:0}
.mw-etop{display:flex;justify-content:space-between;font-size:.8rem;font-weight:700}
.mw-bar{height:12px;background:#d8c7a2;border:2px solid var(--ink);border-radius:99px;overflow:hidden;margin-top:2px}
.mw-bar i{display:block;height:100%;width:0;background:var(--gold);transition:width .25s ease}
.mw-bar.low i{background:var(--red)}
.mw-hint{min-height:2.4em;margin:.4rem 0;font-size:.85rem;line-height:1.25;font-weight:600}
.mw-field{position:relative;display:flex;justify-content:center;align-items:center;min-height:240px;
  border-radius:12px;overflow:hidden;background:#3a2618}
#mw-canvas{display:block;touch-action:none;-webkit-touch-action:none;max-width:100%;cursor:crosshair;outline:none}
.mw-card{position:absolute;inset:8px;margin:auto;max-width:300px;height:fit-content;background:var(--paper);border:3px solid var(--ink);
  border-radius:16px;padding:1rem;text-align:center;box-shadow:0 5px 0 var(--ink);animation:mwpop .28s ease;z-index:3}
.mw-card[hidden],.mw-sheet[hidden]{display:none}
.mw-card h2{font-size:1.5rem;margin-bottom:.3rem}
.mw-card p{font-size:.88rem;line-height:1.35;margin-bottom:.7rem}
.mw-card .mw-small,.mw-small{font-size:.75rem;opacity:.8;margin:.5rem 0 0}
.mw-score{font-weight:800;font-size:1.1rem}
.mw-row{display:flex;gap:.5rem;margin-top:.5rem}
.mw-row .mw-btn{flex:1}
.mw-btn{min-height:48px;min-width:48px;padding:.4rem .9rem;border:3px solid var(--ink);background:#fff7e0;color:var(--ink);
  border-radius:12px;font:inherit;font-weight:800;cursor:pointer;box-shadow:0 3px 0 var(--ink);-webkit-tap-highlight-color:transparent}
.mw-btn:active{transform:translateY(3px);box-shadow:none}
.mw-btn[hidden]{display:none}
.mw-main{background:var(--gold);width:100%;font-size:1.05rem}
.mw-btn:focus-visible,.mw-tool:focus-visible,.mw-lv:focus-visible{outline:3px solid #1f6fd1;outline-offset:2px}
.mw-stars{display:flex;justify-content:center;gap:.4rem;margin:.2rem 0 .5rem}
.mw-stars i{width:34px;height:34px;background:#cdbb92;clip-path:polygon(50% 0,62% 36%,98% 38%,69% 60%,80% 96%,50% 74%,20% 96%,31% 60%,2% 38%,38% 36%);display:block}
.mw-stars i.on{background:var(--gold);animation:mwstar .5s ease backwards}
.mw-stars i:nth-child(2).on{animation-delay:.15s}.mw-stars i:nth-child(3).on{animation-delay:.3s}
.mw-tools{display:grid;grid-template-columns:repeat(6,1fr);gap:.35rem;margin-top:.6rem}
.mw-tool{min-height:48px;padding:.2rem;border:3px solid var(--ink);background:#fff7e0;color:var(--ink);border-radius:12px;
  font:inherit;font-size:.78rem;font-weight:800;cursor:pointer;-webkit-tap-highlight-color:transparent}
.mw-tool.on{background:var(--gold)}
.mw-tool[disabled]{opacity:.45;cursor:default}
.mw-tool:active:not([disabled]){transform:translateY(2px)}
.mw-sheet{position:fixed;inset:0;z-index:100;background:rgba(42,27,18,.88);overflow:auto;overscroll-behavior:contain;
  padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
.mw-sheet-in{max-width:420px;margin:0 auto;background:#f1e4c8;color:#2a1b12;border:3px solid #2a1b12;border-radius:16px;padding:.8rem;font-family:ui-rounded,"Trebuchet MS",system-ui,sans-serif}
.mw-sheet-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:.6rem}
.mw-sheet h3{margin:.8rem 0 .4rem;font-size:.95rem}
.mw-lvgrid{display:grid;grid-template-columns:repeat(5,1fr);gap:.4rem}
.mw-lv{min-height:52px;border:3px solid #2a1b12;border-radius:10px;background:#fff7e0;color:#2a1b12;font:inherit;font-weight:800;cursor:pointer;line-height:1.1;padding:.15rem}
.mw-lv small{display:block;font-size:.62rem;letter-spacing:1px}
.mw-lv[disabled]{opacity:.4;cursor:default;background:#d8c7a2}
.mw-lv.cur{background:#f2b632}
.mw-how{margin-top:1rem;font-size:.9rem;line-height:1.5}
.mw-how h2{font-size:1.1rem;margin-bottom:.4rem}.mw-how p{margin-bottom:.6rem}
@keyframes mwpop{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes mwstar{from{transform:scale(0) rotate(-40deg)}to{transform:scale(1) rotate(0)}}
@media (prefers-reduced-motion:reduce){.mw *,.mw-sheet *{animation:none!important;transition:none!important}}
/* full screen: the board fills the stage, intro copy is hidden */
html.pip-immersive .game-wrap.pip-stage,html.pip-native .game-wrap.pip-stage{display:flex;flex-direction:column;max-width:none;overflow:hidden;
  padding:2px max(2px,env(safe-area-inset-right)) max(2px,env(safe-area-inset-bottom)) max(2px,env(safe-area-inset-left))}
html.pip-immersive .pip-stage .mw-how,html.pip-native .pip-stage .mw-how,html.pip-immersive .pip-stage .ad-well,html.pip-native .pip-stage .ad-well,html.pip-immersive .pip-stage .game-title,html.pip-native .pip-stage .game-title,html.pip-immersive .pip-stage .facts,html.pip-native .pip-stage .facts{display:none}
html.pip-immersive .pip-stage>.mw,html.pip-native .pip-stage>.mw{flex:1;min-height:0;display:flex;flex-direction:column;box-shadow:none;border:0;border-radius:0;padding:2px}
html.pip-immersive .pip-stage .mw-hud,html.pip-native .pip-stage .mw-hud{flex:none}
html.pip-immersive .pip-stage .mw-hint,html.pip-native .pip-stage .mw-hint{flex:none;min-height:0;max-height:2.5em;overflow:hidden;margin:.15rem 0;font-size:.78rem}
html.pip-immersive .pip-stage .mw-field,html.pip-native .pip-stage .mw-field{flex:1;min-height:0;border-radius:6px}
html.pip-immersive .pip-stage .mw-card,html.pip-native .pip-stage .mw-card{max-height:calc(100% - 16px);overflow:auto}
html.pip-immersive .pip-stage .mw-tools,html.pip-native .pip-stage .mw-tools{flex:none;margin-top:.25rem}
@media (orientation:landscape){
html.pip-immersive .pip-stage>.mw,html.pip-native .pip-stage>.mw{display:grid;grid-template-columns:minmax(0,1fr) 172px;grid-template-rows:auto auto minmax(0,1fr);column-gap:.4rem}
html.pip-immersive .pip-stage .mw-field,html.pip-native .pip-stage .mw-field{grid-column:1;grid-row:1/4}
html.pip-immersive .pip-stage .mw-hud,html.pip-native .pip-stage .mw-hud{grid-column:2;grid-row:1}
html.pip-immersive .pip-stage .mw-hint,html.pip-native .pip-stage .mw-hint{grid-column:2;grid-row:2;max-height:5em}
html.pip-immersive .pip-stage .mw-tools,html.pip-native .pip-stage .mw-tools{grid-column:2;grid-row:3;grid-template-columns:repeat(2,1fr);align-content:start;margin:0}
html.pip-immersive .pip-stage .mw-card,html.pip-native .pip-stage .mw-card{padding:.6rem}
}
