/* Opt Out: one game frame that fills the box it is given. The slot's size is reserved from viewport units alone, before any
   script runs, so nothing on the page moves when the game starts, changes screen or is refitted. The script measures the slot
   (clientWidth x clientHeight) and draws the frame at a whole number of device pixels per art pixel where that costs little, centred in it.
   On the embed page (/opt-out/embed/) the box is the whole viewport. */

/* no sideways overscroll (browser back-swipe) on the game page; the script also sets this at runtime */
html:has(.oo-stage),body:has(.oo-stage){overscroll-behavior-x:none}

/* ---------- the stage: game first on screen, head first in the DOM ---------- */
.oo-stage,.app .hero.tight.oo-stage{padding-top:12px;padding-bottom:28px}
.oo-stage>.in,.oo-stage>.in.wide{display:flex;flex-direction:column;gap:18px;max-width:none;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.oo-slot{order:1;position:relative;display:grid;place-items:center;box-sizing:border-box;width:100%;overflow:hidden;overflow:clip;overscroll-behavior:auto;
  height:max(420px,calc(100vh - 63px));height:max(420px,calc(100svh - 63px))}
.oo-head{order:2;display:flex;flex-direction:column;gap:14px;align-items:flex-start;width:100%;max-width:1080px;margin:0 auto;box-sizing:border-box}
.oo-stage noscript{order:3}
.app .hero.tight.oo-stage h1,.oo-stage h1{font-size:clamp(26px,3.4vw,40px)}
.oo-keys span{display:inline-block;margin-right:18px}
.oo-keys b{display:inline-block;font-weight:500;letter-spacing:.06em;text-transform:uppercase;background:var(--ink);color:var(--paper);padding:1px 8px;border-radius:var(--r-pill);margin-right:4px}

/* landscape windows: the slot is as wide as the page and at most 16:9, never taller than what is left under the site bar */
@media (min-aspect-ratio:1/1) and (min-width:600px){
  .oo-slot{height:min(calc(100vh - 79px),calc((100vw - 32px)*.5625));height:min(calc(100svh - 79px),calc((100vw - 32px)*.5625));min-height:300px}
}
/* portrait windows: a phone held upright. The frame runs edge to edge under the site bar. */
@media not all and (min-aspect-ratio:1/1) and (min-width:600px){
  .oo-stage,.app .hero.tight.oo-stage{padding-top:4px}
  .oo-stage>.in,.oo-stage>.in.wide{padding-left:0;padding-right:0;gap:20px}
  .oo-head,.oo-stage noscript{padding:0 16px}
  .oo-slot{background:#0d0a12;border-bottom:3px solid var(--ink);height:min(calc(100vh - 63px),calc(100vw * 4 / 3));height:min(calc(100svh - 63px),calc(100vw * 4 / 3));min-height:0}
  .oo-keys span{display:block;margin-right:0}
}
/* a phone on its side (or any very short window): the site bar shrinks to a 32px strip so the field gets the height, and the
   bottom edge keeps clear of the home indicator. Only this page's bar; the links stay, just smaller. */
@media (orientation:landscape) and (max-height:500px){
  body:has(.oo-stage):not(.embed) header.top .in{min-height:32px;gap:12px}
  body:has(.oo-stage):not(.embed) header.top .logo{font-size:20px;padding:4px 2px}
  body:has(.oo-stage):not(.embed) header.top .logo::after{inset:-2px -6px}
  body:has(.oo-stage):not(.embed) header.top nav{gap:2px;margin-right:-8px}
  body:has(.oo-stage):not(.embed) header.top nav a{padding:10px 10px}
  .oo-stage,.app .hero.tight.oo-stage{padding-top:4px}
  .oo-slot{min-height:240px;
    height:calc(100vh - 36px - max(6px,env(safe-area-inset-bottom,0px)));height:calc(100svh - 36px - max(6px,env(safe-area-inset-bottom,0px)))}
}

/* ---------- the frame ---------- */
.oo-frame{position:relative;width:100%;height:100%;flex:none;box-sizing:content-box;background:#0d0a12;border:0;outline:3px solid var(--ink);box-shadow:8px 8px 0 var(--violet);line-height:0;
  touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
@media not all and (min-aspect-ratio:1/1) and (min-width:600px){
  .oo-frame{outline-width:0;box-shadow:none}
}
/* Until the script has fitted the frame (it writes the size as an inline style) the frame is not shown, so it is never seen at the
   wrong size. The animation is only a safety net: if the size never arrives, show the frame anyway. */
.oo-frame:not([style]){width:240px;height:240px;visibility:hidden;animation:oo-show 0s linear 4s forwards}
@keyframes oo-show{to{visibility:visible}}
/* The script sizes and measures these at once. The site turns every transition into a .01ms one when the device asks for less
   motion, which would make a measurement read the old box. Nothing here ever transitions or animates. */
.oo-stage,.oo-slot,.oo-frame[style],.oo-frame canvas,.oo-sr{transition:none!important;animation:none!important}
.oo-frame:focus{outline:3px solid var(--ink)}
.oo-frame.oo-kbd:focus-visible{outline:3px solid #ffe033}
.oo-frame canvas{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}

/* Touch: the page scrolls normally with a swipe over the title and the menus, and never pans while you aim.
   The shell adds oo-play to the frame while aiming is possible (briefing, play, pause), and only on a change of screen. */
.oo-frame,.oo-frame canvas{touch-action:manipulation}
.oo-frame.oo-play,.oo-frame.oo-play canvas{touch-action:none}
/* The in-post player has nothing to scroll, so a pinch on any screen must never zoom it (in a post it would stay zoomed and crop). */
body.embed,body.embed .oo-frame,body.embed .oo-frame canvas{touch-action:none!important}

/* ---------- the embed page: the game alone, filling the player box exactly, no scroll ---------- */
html:has(body.embed){overflow:hidden;overscroll-behavior:none;background:#0d0a12}
body.embed{margin:0;padding:0;background:#0d0a12;overflow:hidden;overscroll-behavior:none;min-height:100vh;min-height:100svh}
body.embed .embed-main{margin:0;padding:0}
body.embed .oo-stage,body.embed.app .hero.tight.oo-stage,body.embed .hero.first.tight.oo-stage{padding:0!important;margin:0;border:0;background:#0d0a12;min-height:0}
body.embed .oo-stage>.in,body.embed .oo-stage>.in.wide{padding:0;gap:0;margin:0;max-width:none}
body.embed .oo-slot{height:100vh;height:100svh;min-height:0;width:100vw;background:#0d0a12;border:0;place-items:center}
body.embed .oo-frame,body.embed .oo-frame:focus{box-shadow:none;outline:0}
body.embed .oo-frame.oo-kbd:focus-visible{outline:2px solid #ffe033;outline-offset:-2px}
body.embed .embed-foot{position:absolute;left:0;top:0;width:1px;height:1px;margin:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* the link itself is clipped to its 1px box too, so nothing is ever wider than the player; on keyboard focus it becomes a readable bar along the bottom that wraps to fit even a 300px box */
body.embed .embed-foot a{display:block;width:100%;max-width:100vw;overflow:hidden;box-sizing:border-box}
body.embed .embed-foot:focus-within{position:fixed;left:6px;right:6px;top:auto;bottom:6px;width:auto;height:auto;max-width:calc(100vw - 12px);overflow:visible;clip-path:none;white-space:normal;z-index:20}
body.embed .embed-foot:focus-within a{width:auto;padding:8px 10px;background:#0d0a12;color:#ffe033;border:2px solid #ffe033;font:700 14px/1.3 system-ui,sans-serif;text-align:center;overflow-wrap:break-word;outline:0;text-decoration:underline}
/* kit.js appends a visually hidden live region to the body; pinned to the top so it cannot add a pixel of scroll under the frame */
body.embed>.vh{left:0;top:0;margin:0}

/* screen-reader only */
.oo-sr{position:absolute;left:0;top:0;width:1px;height:1px;margin:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;font-size:16px;line-height:1.2}
.oo-keys{margin:0;width:100%;max-width:none;font:500 13px/1.7 var(--mono);color:var(--ink)}

/* ---------- full screen: the game area alone fills the screen, the game refits to it (30-shell-core.js toggleBig) ---------- */
.oo-slot:fullscreen{width:100vw!important;height:100vh!important;max-width:none;min-height:0;margin:0;padding:0;border:0;background:#0d0a12;display:grid;place-items:center}
.oo-slot:-webkit-full-screen{width:100vw!important;height:100vh!important;max-width:none;min-height:0;margin:0;padding:0;border:0;background:#0d0a12;display:grid;place-items:center}
.oo-slot::backdrop{background:#0d0a12}

/* ---------- the in-post player's button bar (made by the script on the embed page only). The game and the bar share the player box
   as one centred column with no dead gap; the script sets the slot's and the bar's heights (see 36-shell-fs.js) and whether the two
   buttons sit side by side or stack. Until it runs, the slot leaves room for a one-row bar. ---------- */
body.embed .oo-stage>.in,body.embed .oo-stage>.in.wide{display:flex;flex-direction:column;justify-content:center;align-items:stretch;
  height:100vh;height:100svh;box-sizing:border-box;background:#0d0a12}
body.embed .oo-slot{flex:none;align-self:center;max-width:100vw;height:calc(100vh - 68px);height:calc(100svh - 68px)}
body.embed .oo-stage>.in:fullscreen{height:100%;width:100%}
body.embed .oo-bar{order:2;flex:none;display:flex;flex-direction:row;gap:12px;box-sizing:border-box;height:68px;padding:10px 12px 14px 10px;background:#0d0a12;--fz:16px}
body.embed .oo-bar.oo-stack{flex-direction:column;gap:8px}
body.embed .oo-bb{--o:4px;flex:1 1 0;min-width:0;min-height:0;display:flex;align-items:center;justify-content:center;gap:.5em;box-sizing:border-box;
  padding:0 12px;border:3px solid var(--paper,#fffdf6);border-radius:999px;background:var(--ink,#141018);color:var(--paper,#fffdf6);
  font:800 var(--fz)/1 var(--display,"Bricolage Grotesque",Arial,sans-serif);letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-decoration:none;
  box-shadow:var(--o) var(--o) 0 var(--violet,#7b4dff);transition:translate .13s,box-shadow .13s;
  touch-action:manipulation!important;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;cursor:pointer}
body.embed .oo-bb.oo-bb-big{background:var(--lime,#b9f53c);color:var(--ink,#141018);border-color:var(--ink,#141018);box-shadow:var(--o) var(--o) 0 var(--pink,#ff3d8b)}
body.embed .oo-bb svg{width:.95em;height:.95em;flex:none;display:block}
body.embed .oo-bb span{overflow:hidden;text-overflow:ellipsis}
body.embed .oo-bb:hover{translate:-2px -2px;box-shadow:calc(var(--o) + 2px) calc(var(--o) + 2px) 0 var(--violet,#7b4dff)}
body.embed .oo-bb.oo-bb-big:hover{box-shadow:calc(var(--o) + 2px) calc(var(--o) + 2px) 0 var(--pink,#ff3d8b)}
body.embed .oo-bb:active{translate:3px 3px;box-shadow:1px 1px 0 var(--violet,#7b4dff)}
body.embed .oo-bb:focus-visible{outline:3px solid var(--yellow,#ffe033);outline-offset:3px}
@media (prefers-reduced-motion:reduce){body.embed .oo-bb{transition:none}}
