:root{
  --guide-color-scheme:light;
  --guide-paper:#f9fcff;--guide-ink:#263641;--guide-muted:#546978;--guide-surface:#edf2f6;--guide-hover:#dfe9ee;
  --guide-line:#d4e0e8;--guide-panel-line:#d3e0e8;--guide-divider:#dfe8ec;--guide-accent:#437c1c;--guide-brand:#427b20;--guide-focus:#4cba00;
  --guide-opener-hover:#eef6e5;--guide-opener-shadow:#31592b0c;--guide-panel-shadow:#15344338;--guide-backdrop:#0b2a4777;
  --guide-page:#f7f2e4;
}
:root[data-theme="dark"]{
  --guide-color-scheme:dark;
  --guide-paper:#3c3c3c;--guide-ink:#f4f7fc;--guide-muted:#c4c4c4;--guide-surface:#454545;--guide-hover:#535353;
  --guide-line:#575757;--guide-panel-line:#575757;--guide-divider:#575757;--guide-accent:#79d943;--guide-brand:#79d943;--guide-focus:#54c800;
  --guide-opener-hover:#535353;--guide-opener-shadow:#00000020;--guide-panel-shadow:#00000066;--guide-backdrop:#050b14b3;
  --guide-page:#1f232c;
}
/* "about the game" as a marker sticker, like the cards of the game menu, and
   the guide window as a paper sheet with an ink outline. The marker colours
   are defined in shell.css, the fonts in marker-fonts.css. */
#game-guide-open{position:fixed;z-index:8;left:max(22px,env(safe-area-inset-left,0px));top:max(20px,env(safe-area-inset-top,0px));display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;min-height:46px;padding:5px 14px 5px 8px;border:3px solid var(--marker-ink);border-radius:16px 10px 14px 9px/10px 14px 9px 16px;background:var(--marker-paper);color:var(--marker-ink);box-shadow:3px 4px 0 var(--marker-shadow);font:800 16px/1.2 "Fatter Marker","Comic Sans MS","Chalkboard SE",cursive;text-decoration:none;transform:rotate(-2deg);transition:background .15s,transform .15s,box-shadow .15s}
#game-guide-open:hover{background:var(--marker-hover);transform:rotate(-2deg) translateY(-2px);box-shadow:4px 6px 0 var(--marker-shadow)}
#game-guide-open:active{transform:rotate(-2deg) translate(2px,3px);box-shadow:1px 1px 0 var(--marker-shadow)}
#game-guide-open:focus-visible{outline:3px solid #ff7a1a;outline-offset:4px}
.guide-info-icon{flex:none;width:30px;height:30px}
#game-guide-dialog{color-scheme:var(--guide-color-scheme);box-sizing:border-box;width:min(1020px,calc(100vw - 48px));height:min(780px,calc(100dvh - 64px));max-width:none;max-height:none;margin:auto;padding:0;overflow:hidden;border:3px solid var(--marker-ink);border-radius:26px 18px 24px 16px/18px 24px 16px 26px;background:var(--guide-page);color:var(--marker-ink);box-shadow:6px 8px 0 var(--marker-shadow)}
#game-guide-dialog[open]{display:flex;flex-direction:column;animation:guide-appear .18s ease-out}
#game-guide-dialog::backdrop{background:var(--guide-backdrop);backdrop-filter:blur(4px)}
.game-guide-header{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;gap:16px;padding:12px 18px 12px 24px;border-bottom:3px solid var(--marker-ink);background:var(--marker-paper)}
.game-guide-brand{display:inline-block;padding:0 5px;background:linear-gradient(transparent 50%,var(--marker-swipe) 50% 95%,transparent 95%);color:var(--marker-ink);font:800 13px/1.3 "Fatter Marker","Comic Sans MS",cursive;letter-spacing:.08em;transform:rotate(-2deg)}
.game-guide-header h2{margin:2px 0 0;font:800 24px/1.15 "Fatter Marker","Comic Sans MS","Chalkboard SE",cursive;text-transform:lowercase}
.game-guide-actions{display:flex;align-items:center;gap:16px}
.game-guide-actions a{padding:1px 2px 3px;color:var(--marker-ink);font:800 14px/1.4 "Fatter Marker","Comic Sans MS",cursive;text-decoration:none;text-transform:lowercase;background:linear-gradient(var(--marker-underline),var(--marker-underline)) 0 100%/100% 3px no-repeat}
.game-guide-actions a:hover{background:linear-gradient(var(--marker-swipe),var(--marker-swipe)) 0 85%/100% 55% no-repeat;color:#1f1a17}
.game-guide-actions a:focus-visible{outline:3px solid var(--marker-focus);outline-offset:3px;border-radius:4px}
#game-guide-close{display:grid;place-items:center;flex-shrink:0;width:42px;height:42px;padding:0 0 3px;margin:0;background:var(--marker-paper);border:3px solid var(--marker-ink);border-radius:50%;color:var(--marker-ink);box-shadow:2px 3px 0 var(--marker-shadow);font:800 26px/1 "Fatter Marker","Comic Sans MS",cursive;cursor:pointer;transform:rotate(-4deg)}
#game-guide-close:hover{background:var(--marker-hover)}
#game-guide-close:active{transform:rotate(-4deg) translate(1px,2px);box-shadow:0 0 0 var(--marker-shadow)}
#game-guide-close:focus-visible{outline:3px solid var(--marker-focus);outline-offset:3px}
#game-guide-frame{display:block;width:100%;flex:1;min-height:0;border:0;background:var(--guide-page)}
@keyframes guide-appear{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:900px){#game-guide-open{left:max(12px,env(safe-area-inset-left,0px));top:max(14px,env(safe-area-inset-top,0px));min-height:42px;padding:4px 12px 4px 6px;font-size:14px;gap:6px}.guide-info-icon{width:26px;height:26px}#game-guide-dialog{width:calc(100vw - 24px);height:calc(100dvh - 24px);border-radius:18px}.game-guide-header{padding:12px 18px}.game-guide-header h2{font-size:19px}}
@media(max-height:500px){#game-guide-dialog{height:calc(100dvh - 16px)}.game-guide-header{padding:8px 16px}.game-guide-brand{display:none}.game-guide-header h2{margin:0;font-size:18px}#game-guide-close{width:34px;height:34px}.game-guide-actions{gap:14px}}
.fatter-mobile #game-guide-open{left:max(8px,env(safe-area-inset-left,0px));top:max(6px,env(safe-area-inset-top,0px));min-height:34px;padding:2px 9px 2px 4px;border-width:2px;font-size:12px;gap:5px;box-shadow:2px 3px 0 var(--marker-shadow)}
.fatter-mobile .guide-info-icon{width:22px;height:22px}
.fatter-mobile #game-guide-dialog{--guide-edge-left:max(6px,env(safe-area-inset-left,0px));--guide-edge-right:max(6px,env(safe-area-inset-right,0px));--guide-edge-top:max(6px,env(safe-area-inset-top,0px));--guide-edge-bottom:max(6px,env(safe-area-inset-bottom,0px));top:calc(var(--mobile-visible-top,0px) + var(--guide-edge-top));bottom:auto;left:var(--guide-edge-left);right:var(--guide-edge-right);margin:0 auto;width:min(1020px,calc(100vw - var(--guide-edge-left) - var(--guide-edge-right)));height:min(780px,calc(var(--mobile-visible-height,100dvh) - var(--guide-edge-top) - var(--guide-edge-bottom)));border-radius:13px}
.fatter-mobile .game-guide-header{padding:5px 10px;gap:10px}
.fatter-mobile .game-guide-brand{display:none}
.fatter-mobile .game-guide-header h2{margin:0;font-size:16px}
.fatter-mobile .game-guide-actions{gap:12px}
.fatter-mobile .game-guide-actions a{font-size:11px}
.fatter-mobile #game-guide-close{width:32px;height:32px;font-size:25px}
@media(prefers-reduced-motion:reduce){#game-guide-dialog[open]{animation:none}#game-guide-open{transition:none}}
/* Keep the loaded desktop footer below the game at every window width. */
:root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links{top:auto;bottom:max(12px,env(safe-area-inset-bottom,0px))}
:root:not(.fatter-mobile) body:has(#loading[hidden]) #privacy-status{top:auto;bottom:calc(70px + env(safe-area-inset-bottom,0px))}
/* A compact help button shares the mobile footer, leaving Profile and Back
   accessible even on narrow screens and phones with landscape safe insets. */
:root.fatter-mobile body:has(#loading[hidden]) #game-guide-open{top:auto;bottom:calc(2px + env(safe-area-inset-bottom,0px));left:calc(8px + env(safe-area-inset-left,0px));width:36px;height:32px;min-height:32px;padding:3px;gap:0;justify-content:center;transform:none}
:root.fatter-mobile body:has(#loading[hidden]) #game-guide-open .guide-info-icon{width:24px;height:24px}
:root.fatter-mobile body:has(#loading[hidden]) #game-guide-open span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
:root.fatter-mobile body:has(#loading[hidden]) #legal-links{left:calc(52px + env(safe-area-inset-left,0px))}
/* Short desktop windows scale the canvas, but DOM help stays CSS-sized.
   Keep its accessible icon clear of the wardrobe's Back button. */
@media(max-height:600px){
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #game-guide-open{left:8px;top:8px;width:36px;height:34px;min-height:34px;padding:3px;gap:0;justify-content:center;transform:none}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #game-guide-open .guide-info-icon{width:24px;height:24px}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #game-guide-open span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links{box-sizing:border-box;top:auto;bottom:0;left:6px;right:6px;height:26px;display:flex;flex-wrap:nowrap;justify-content:flex-start;align-items:center;max-width:none;gap:0 8px;padding:1px 8px 2px;font-size:10.5px;border-width:2px 2px 0;border-radius:10px 8px 0 0;box-shadow:none;transform:none;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;white-space:nowrap}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links>:first-child{margin-left:auto}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links>:last-child{margin-right:auto}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links a,:root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links button{flex-shrink:0}
  :root:not(.fatter-mobile) body:has(#loading[hidden]) #legal-links .separator{display:none}
}
