:root { --bg: #0b0b0d; --panel: #16161a; --line: #2a2a31; --text: #e8e6e3; --muted: #9a978f; --gold: #d4af37; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-sizing: border-box; }
#stage { position: relative; width: 765px; height: 503px; max-width: 100vw; }
#game { width: 765px; height: 503px; background: #000; }
/* until the client draws its own loading bar, the page shows the same one (owner, 2026-11-14: "that red loader board ...
   so it looks like real osrs"): the client's GameEngine.drawInitial on black, a 304x34 box outlined in rgb(140,17,17)
   with a 1 px black gap, the fill from x 2 (percent x 3 wide, 30 high), bold 13 px Helvetica in white, centred */
#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #000; text-align: center; }
#loading[hidden], .gate[hidden] { display: none; }
#loadbar { position: relative; width: 304px; height: 34px; box-sizing: border-box; border: 1px solid rgb(140, 17, 17); background: #000; }
#loadbar-fill { position: absolute; left: 1px; top: 1px; width: 0; height: 30px; background: rgb(140, 17, 17); }
#status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap;
  font: bold 13px Helvetica, Arial, sans-serif; color: #fff; }
#detail { color: var(--muted); min-height: 1.4em; max-width: 90%; }
/* ---- the gate screens (boot.js showGate): add to the Home Screen (iPhone, iPad), the Android app, the download (a
   computer). Drawn as the client's title screen (owner, 2026-11-14: "copy what osrs has and put our logo on top"): the
   login background full-bleed, our logo above the stone login box, yellow headings and white text with the client's
   1 px black shadow. Art from our cache (tools/web-client/gate-art/render.sh): the box and its button are 3x sprites
   used as border images (their frame kept), the box's stone as a seamless tile filling it. A system font: the client's fonts are
   Jagex's own. Safe areas respected; portrait stacks, a short landscape screen puts the logo beside the box. */
.gate { position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #000 var(--title-bg) center / cover no-repeat; color: #fff;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  font: 600 15px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; text-shadow: 1px 1px 0 #000; }
/* centred while it fits, scrollable from its top when it does not (justify-content: center would cut the top off) */
.gate > :first-child { margin-top: auto; }
.gate > :last-child { margin-bottom: auto; }
.gate .title-logo { width: min(445px, 92vw); height: auto; flex: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.gate .titlebox { width: min(440px, 100%); box-sizing: border-box; padding: 18px 20px 20px;
  border: 16px solid transparent; border-image: var(--titlebox) 48 / 16px / 0 stretch;
  background: #1f2a17 var(--titlestone) 0 0 / 656px 336px repeat padding-box;
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gate h1 { margin: 0; font: 700 19px/1.3 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; color: #ffff00; }
.gate p { margin: 0; color: #fff; }
.gate ol { margin: 2px 0 0; padding: 0; list-style: none; counter-reset: step; text-align: left; width: 100%; }
.gate li { counter-increment: step; display: flex; gap: 10px; align-items: center; padding: 7px 4px; }
.gate li + li { border-top: 1px solid rgba(0, 0, 0, 0.45); box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06); }
.gate li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: #ffff00; color: #000; font-weight: 800; text-shadow: none; box-shadow: 1px 1px 0 #000; }
.gate li strong { color: #ffff00; }
.gate li svg { flex: none; width: 20px; height: 20px; color: #ffff00; vertical-align: -4px; filter: drop-shadow(1px 1px 0 #000); }
.gate .titlebutton { display: inline-flex; align-items: center; justify-content: center; min-width: 147px; min-height: 41px; box-sizing: border-box;
  margin-top: 4px; padding: 0 22px; border: 8px solid transparent; border-image: var(--titlebutton) 24 fill / 8px / 0 stretch;
  color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; }
.gate .titlebutton:active { filter: brightness(1.25); }
@media (orientation: landscape) and (max-height: 540px) {
  .gate { flex-direction: row; justify-content: center; gap: 20px; }
  .gate > :first-child, .gate > :last-child { margin: auto 0; }
  .gate .title-logo { width: min(38vw, 340px); }
  .gate .titlebox { width: min(54vw, 460px); padding: 10px 14px 12px; gap: 6px; }
  .gate h1 { font-size: 17px; }
  .gate li { padding: 4px 4px; }
}

/* ---- the touch layer (touch.js, 2026-11-07): phones and tablets --------------------------------------------------- */
#safe-area-probe { position: fixed; visibility: hidden; pointer-events: none; left: 0; top: 0; width: 0; height: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#press-ring, #keyboard-button, #keyboard-input, #notice { display: none; }
#notice[hidden], #press-ring[hidden], #notice-action[hidden] { display: none !important; }
/* the whole page is the game: no scroll, bounce, zoom, selection or callout */
html:has(body.touch) { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.touch { display: block; position: fixed; inset: 0; padding: 0; overflow: hidden; overscroll-behavior: none; background: #000;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; }
body.touch #stage { position: fixed; inset: 0; width: auto; height: auto; max-width: none; background: #000; touch-action: none; }
body.touch #game { position: absolute; transform-origin: 0 0; background: #000; }
/* whole device pixels per game pixel: keep them square instead of blurring them */
body.touch #game.crisp canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
body.touch #loading { position: fixed; inset: 0; border: 0; border-radius: 0; }
/* "Sign out" under Play Now (touch.js placeSignOut): the client's own button art, scaled with the game, crisp */
#signout-button { position: absolute; z-index: 2; background: var(--signout) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; cursor: pointer; }
#signout-button[hidden] { display: none; }
/* the menu row under a held finger (touch.js showMenuRow): the whole row lit, background included, so it shows beside
   the finger (owner, 2026-11-13: "it should highlight the whole thing (even the background)"). The Android app fills the
   held row with (141, 132, 119), no outline (its banker menu screenshot, run3 59); "lighten" keeps each pixel's brighter
   channel, so the row's brown turns that colour and the option's text, brighter, stays as the client drew it. */
#menu-row { display: none; }
body.touch #menu-row { display: block; position: fixed; z-index: 4; pointer-events: none; background: rgb(141, 132, 119); mix-blend-mode: lighten; }
body.touch #menu-row[hidden] { display: none; }
/* upright in game: the body is turned 90 degrees and sized to the screen turned; it is then the containing block of every
   fixed element, so the whole page stays in landscape. No min-height: the body's 100vh (the upright screen's height) beat
   the turned height touch.js sets, so the body was a square and the loading screen (fixed, inset 0) centred its red bar off
   the screen: a black screen through the whole game-data download (owner 2026-11-15, iPhone 440x956 upright) */
body.touch.rotated { inset: auto; top: 0; left: 0; transform-origin: 0 0; min-height: 0; }
body.touch #press-ring { display: block; position: fixed; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  pointer-events: none; z-index: 5; background: conic-gradient(rgba(212, 175, 55, .85) var(--fill, 0deg), rgba(255, 255, 255, .12) 0);
  -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px); mask: radial-gradient(circle, transparent 23px, #000 24px); }
@property --fill { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
/* the fill takes the player's long-press time (touch.js longPressMs: varbit 13835, 300 ms by default) */
body.touch #press-ring.filling { animation: press-fill var(--press-ms, 300ms) linear forwards; }
body.touch #press-ring.done { --fill: 360deg; transform: scale(1.18); opacity: 0; transition: transform .18s ease-out, opacity .18s ease-out; }
@keyframes press-fill { from { --fill: 0deg; } to { --fill: 360deg; } }
body.touch #keyboard-button { display: flex; align-items: center; justify-content: center; position: fixed; z-index: 4;
  left: var(--keyboard-left, max(6px, env(safe-area-inset-left))); top: 50%; width: 40px; height: 40px; margin-top: -20px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(11, 11, 13, .55); color: #e8e6e3; touch-action: manipulation; }
/* the mobile frame (601) has its own keyboard button (601:48, touch.js): no floating one there */
body.touch.mobile-frame #keyboard-button { display: none; }
/* only in game (owner 2026-11-15: "a weird keyboard icon ... half off screen and unpressable"; 2026-11-16: still seen
   "during the initial client load"): none while the client loads or on the login screen, where tapping a login field
   opens the keyboard, as in the Android app; touch.js sets in-game once the client is logged in */
body.touch:not(.in-game) #keyboard-button { display: none; }
/* placed by touch.js applyLayout from the layout's own insets (the page turned for an upright phone has its notch on
   the game's left, where env(safe-area-inset-left) reads 0): centred in a wide inset, a little above the middle, where
   the camera cutout is not */
body.touch #keyboard-button.in-inset { left: var(--keyboard-left, 6px); top: 30%; }
body.touch #keyboard-button svg { width: 24px; height: 24px; }
body.touch #keyboard-button.active { border-color: var(--gold); color: var(--gold); }
body.touch #keyboard-button.wanted { animation: wanted 1s ease-in-out infinite; }
@keyframes wanted { 50% { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, .35); } }
/* focusable (iOS shows its keyboard only for a visible, focusable field), but out of sight; 16px stops iOS zooming in */
body.touch #keyboard-input { display: block; position: fixed; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; margin: 0;
  opacity: 0; font-size: 16px; color: transparent; background: transparent; caret-color: transparent; z-index: -1; }
body.touch #notice { display: flex; position: fixed; z-index: 6; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%);
  gap: 10px; align-items: center; max-width: calc(100% - 32px); background: rgba(22, 22, 26, .92); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 12px; font-size: 13px; }
body.touch #notice button { background: none; border: 1px solid var(--gold); color: var(--gold); border-radius: 4px; padding: 3px 10px; font: inherit; }
/* desktop input (touch.js "desktop"): the game element holds the keyboard focus; no focus ring or selection on it */
#game.desktop-input { outline: none; -webkit-user-select: none; user-select: none; }
/* desktop: the notice still says when the game data is downloading again or a connection is lost */
body:not(.touch) #notice { display: flex; gap: 10px; align-items: center; margin-top: 8px; color: var(--muted); }
