.maker-game{border:0;background:none;color:inherit;font:inherit;cursor:pointer;padding:0;text-decoration:none}.maker-game:hover{text-decoration:underline}.maker-game:focus-visible{outline:2px solid currentColor;outline-offset:5px}.forest-game{width:min(440px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:22px;border:1px solid #657062;border-radius:16px 16px 48px 16px;background:#c7cbbb;color:#263326;box-shadow:0 25px 100px #0008;font-family:monospace}.forest-game::backdrop{background:#07140fe8;backdrop-filter:blur(8px)}.forest-head{display:flex;align-items:center;justify-content:space-between;font-size:10px;letter-spacing:2px}.forest-close{border:1px solid #87917e;background:transparent;border-radius:50%;width:34px;height:34px;color:#263326;font-size:24px;cursor:pointer}.forest-game h2{font-family:monospace;font-size:30px;font-weight:900;letter-spacing:4px;margin:12px 0 3px}.forest-sub{font-size:11px;margin:0 0 18px}.forest-screen{padding:12px;background:#66705e;border-radius:7px 7px 24px 7px;box-shadow:inset 0 2px 5px #0004}.forest-score{display:flex;justify-content:space-between;background:#9bbc0f;color:#0f380f;padding:9px;font-size:11px;border-bottom:2px solid #306230}.forest-score b{font-weight:900}.forest-game canvas{display:block;width:100%;height:auto;image-rendering:pixelated;background:#9bbc0f;outline-offset:3px}.forest-message{margin:0;padding:9px 3px;text-align:center;color:#0f380f;background:#9bbc0f;font-size:10px;min-height:32px}.forest-controls{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:22px 12px 4px}.forest-pad{display:grid;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(2,42px);gap:3px}.forest-pad button:first-child{grid-column:2}.forest-pad button:nth-child(2){grid-column:1;grid-row:2}.forest-pad button:nth-child(3){grid-column:2;grid-row:2}.forest-pad button:nth-child(4){grid-column:3;grid-row:2}.forest-controls button{touch-action:none;user-select:none;border:0;background:#283428;color:#c7cbbb;box-shadow:0 3px 0 #101b10;font:700 16px monospace;cursor:pointer;border-radius:5px}.forest-controls button:active{transform:translateY(2px);box-shadow:0 1px 0 #101b10}.forest-controls .forest-saw{width:100px;height:65px;border-radius:40px;transform:rotate(-12deg);font-size:14px}.forest-saw small{display:block;font-size:11px;opacity:.6;margin-top:4px}.forest-help{text-align:center;font-size:10px;line-height:1.8;margin:16px 0 0;color:#4c5945}@media(max-width:380px){.forest-game{padding:15px}.forest-controls{padding-inline:0;gap:10px}.forest-pad{grid-template-columns:repeat(3,38px);grid-template-rows:repeat(2,40px)}}

/* Keep the complete controller visible on small phones and in landscape. */
.forest-game{box-sizing:border-box;overscroll-behavior:contain;max-height:calc(100svh - 16px);padding:18px;margin:auto;scrollbar-width:thin}
.forest-close{width:44px;height:44px;flex-shrink:0;touch-action:manipulation}
.forest-pad{grid-template-columns:repeat(3,46px);grid-template-rows:repeat(2,46px)}
.forest-controls{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.forest-controls button{min-width:44px;min-height:44px;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
.forest-controls button.is-held{background:#0f380f;color:#9bbc0f;box-shadow:inset 0 2px 4px #0008}
.forest-game canvas{max-height:calc(100svh - 330px);width:auto;max-width:100%;margin:auto;aspect-ratio:5/4}
.forest-screen{background:#66705e}.forest-score,.forest-message{max-width:100%}
@media(max-width:380px){.forest-game{padding:12px}.forest-controls{padding:14px 0 2px;gap:10px}.forest-game h2{font-size:25px;margin-top:6px}.forest-sub{margin-bottom:12px}.forest-screen{padding:8px}.forest-help{margin-top:10px}.forest-game canvas{max-height:calc(100svh - 290px)}}
@media(max-height:480px) and (min-width:480px){.forest-game[open]{width:min(700px,calc(100% - 16px));display:grid;grid-template-columns:minmax(0,1fr) 250px;column-gap:18px;padding:12px 18px;border-radius:14px 14px 30px 14px}.forest-head{grid-column:1/-1}.forest-game h2{grid-column:2;grid-row:2;font-size:24px;align-self:end;margin:0}.forest-sub{display:none}.forest-screen{grid-column:1;grid-row:2/5;padding:8px}.forest-game canvas{max-height:calc(100svh - 155px)}.forest-controls{grid-column:2;grid-row:3;padding:12px 0;gap:8px}.forest-controls .forest-saw{width:86px}.forest-help{grid-column:2;grid-row:4;margin:0;font-size:9px}.forest-game canvas{max-height:calc(100svh - 155px)}}

@media(max-width:380px){.forest-game canvas{width:min(100%,calc((100svh - 410px) * 1.25));max-height:none;height:auto}.forest-help{font-size:9px}.forest-game{max-height:calc(100svh - 16px)}}

/* Named record stays visible inside the game, at the bottom right. */
.forest-record{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:10px 4px 2px;color:#e1e7cb;font-size:11px}.forest-record>span{font-size:9px;letter-spacing:1px}.forest-record-name{max-width:160px;overflow-wrap:anywhere}.forest-record-points{white-space:nowrap}.forest-name-form[hidden]{display:none}.forest-name-form{margin:16px 0 0;padding:14px;border:2px solid #306230;background:#e1e7cb;color:#0f380f;border-radius:6px}.forest-name-form h3{font:700 18px monospace;letter-spacing:0;margin:0 0 12px}.forest-name-form label{display:block;font:14px monospace;margin-bottom:6px}.forest-name-form input{box-sizing:border-box;width:100%;min-height:44px;padding:10px;border:1px solid #306230;background:#f3f5e9;color:#0f380f;font:16px monospace;border-radius:3px}.forest-name-form p{font:11px/1.5 monospace;margin:8px 0 12px}.forest-name-form>div{display:flex;flex-wrap:wrap;gap:8px}.forest-name-form button{min-height:44px;border:1px solid #306230;background:#0f380f;color:#e1e7cb;padding:9px;font:12px monospace}.forest-name-form .forest-name-skip{background:transparent;color:#0f380f}.forest-name-form~.forest-controls{transition:opacity .15s}.forest-game:has(.forest-name-form:not([hidden])) .forest-controls{display:none}@media(max-height:480px) and (min-width:480px){.forest-name-form{grid-column:2;grid-row:3/5;margin-top:8px}.forest-game:has(.forest-name-form:not([hidden])) .forest-help{display:none}}

/* Screen-filling playfield; browser fullscreen when supported, viewport fallback otherwise. */
.forest-game[open]{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:none;min-height:0;border:0;border-radius:0;padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,300px);grid-template-rows:auto minmax(0,1fr) auto;gap:12px 24px;overflow:hidden;background:#bac1ab}
.forest-game .forest-head{grid-column:1/-1;grid-row:1}.forest-game h2{grid-column:2;grid-row:2;align-self:start;font-size:32px;margin:16px 0 0}.forest-game .forest-sub{display:none}.forest-game .forest-screen{grid-column:1;grid-row:2/4;min-height:0;display:flex;flex-direction:column;padding:12px;overflow:hidden;border-radius:8px}.forest-game canvas{flex:1;min-height:0;width:100%;height:100%;max-height:none;max-width:100%;object-fit:contain;aspect-ratio:auto;background:#66705e}.forest-game .forest-controls{grid-column:2;grid-row:2;align-self:center;padding:90px 0 20px;gap:16px;justify-content:space-around}.forest-game .forest-help{grid-column:2;grid-row:3;font-size:12px;line-height:1.8;margin:0}.forest-game .forest-name-form{grid-column:2;grid-row:2;align-self:center;z-index:2;margin-top:60px}.forest-game .forest-record{flex-shrink:0}.forest-game #wood-score.is-penalty{color:#9bbc0f;background:#0f380f;padding:2px 4px}.forest-game .forest-score{font-size:14px}.forest-game .forest-message{font-size:12px;line-height:1.5;min-height:36px}.forest-game .forest-close{width:46px;height:46px}
@media(max-width:600px){.forest-game[open]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto;gap:8px;padding:10px 12px max(8px,env(safe-area-inset-bottom))}.forest-game .forest-head{grid-column:1;grid-row:1}.forest-game h2{display:none}.forest-game .forest-screen{grid-column:1;grid-row:2;padding:8px}.forest-game .forest-controls{grid-column:1;grid-row:3;padding:8px 8px 2px;justify-content:space-between}.forest-game .forest-help{grid-column:1;grid-row:4;font-size:10px;line-height:1.5}.forest-game .forest-name-form{grid-column:1;grid-row:3;margin:0}.forest-game .forest-score{font-size:12px}.forest-game .forest-message{font-size:11px}.forest-game .forest-pad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,42px)}.forest-game .forest-controls .forest-saw{height:68px;width:110px}.forest-game .forest-record{font-size:10px;padding:7px 2px 0}}
@media(max-height:500px) and (min-width:601px){.forest-game[open]{grid-template-columns:minmax(0,1fr) 250px;gap:8px 18px;padding:8px 14px}.forest-game h2{font-size:24px;margin-top:0}.forest-game .forest-controls{padding:50px 0 0}.forest-game .forest-help{font-size:10px}.forest-game .forest-head{font-size:9px}.forest-game .forest-name-form{margin-top:30px;padding:10px}.forest-game .forest-record{padding-top:4px}.forest-game .forest-screen{padding:6px}}

/* Desktop: keep the game in a compact centered window. */
@media(min-width:601px){.forest-game[open]{inset:0;margin:auto;width:min(900px,calc(100% - 48px));height:min(600px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);border:1px solid #657062;border-radius:16px;padding:18px;grid-template-columns:minmax(0,1fr) 240px;gap:12px 20px;box-shadow:0 25px 100px #0008}.forest-game h2{font-size:28px}.forest-game .forest-score{font-size:12px}.forest-game .forest-help{font-size:11px}}
@media(min-width:601px) and (max-height:500px){.forest-game[open]{width:calc(100% - 24px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);padding:10px 14px;gap:8px 18px}.forest-game h2{font-size:24px}.forest-game .forest-help{font-size:10px}}

.forest-ranking{margin-top:14px;padding-top:12px;border-top:1px solid #87917e;text-align:left;font:11px/1.5 monospace}.forest-ranking ol{padding-left:26px;margin:8px 0;max-height:110px;overflow:auto}.forest-ranking label{font:11px monospace;margin:8px 0}.forest-ranking input{width:100%;min-height:36px;padding:7px;background:#e1e7cb;color:#0f380f;border:1px solid #657062;font:13px monospace}.forest-ranking button{min-height:36px;padding:7px 10px;background:#0f380f;color:#e1e7cb;border:0;font:11px monospace}.forest-ranking [role=status]{display:block;margin-top:6px;font-size:10px}.forest-game .forest-help{max-height:100%;overflow:auto}.forest-ranking button:disabled{opacity:.6}@media(max-width:600px){.forest-game .forest-help{max-height:150px}.forest-ranking{margin-top:8px}.forest-ranking ol{max-height:70px}}

/* Keep keyboard focus within the nickname field, clear of its label. */
.forest-ranking input:focus-visible,.forest-name-form input:focus-visible{outline:2px solid #306230;outline-offset:-3px}
