/* The game shell (docs/GAME_SHELL.md): the site's look B, over any game. Sits above the game's own canvas. */
.sgr-shell { --ink: #15254e; --paper: #fdfdfb; --muted: #737c95; --chip: #eff0f3; --tchips: #4f46a5;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif; --mono: "Fragment Mono", ui-monospace, Menlo, monospace;
  position: fixed; inset: 0; pointer-events: none; z-index: 1000; font: 15px/1.4 var(--sans); color: var(--ink); }
.sgr-shell [hidden] { display: none !important; }
/* the shell's own boxes, untouched by whatever a game's stylesheet says about buttons and links */
.sgr-shell, .sgr-shell * { box-sizing: border-box; }
.sgr-shell button, .sgr-shell a { all: unset; box-sizing: border-box; cursor: pointer; }
.sgr-shell .sgr-bar { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; pointer-events: auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px)); }
.sgr-shell .sgr-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; text-decoration: none;
  background: rgba(253, 253, 251, 0.92); color: var(--ink); font: 600 16px/1 var(--sans); box-shadow: 0 1px 6px rgba(10, 16, 34, 0.18); }
.sgr-shell .sgr-title { font: 600 12px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); margin-right: auto; }
.sgr-shell .sgr-bal { font: 12.5px/1 var(--mono); padding: 10px 12px; border-radius: 999px; background: rgba(253, 253, 251, 0.92); box-shadow: 0 1px 6px rgba(10, 16, 34, 0.18); white-space: nowrap; }
.sgr-shell .sgr-menu { position: absolute; z-index: 1; inset: 0; display: none; place-items: center; background: rgba(21, 37, 78, 0.45); backdrop-filter: blur(3px); pointer-events: auto; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sgr-shell.open .sgr-menu { display: grid; }
.sgr-shell .sgr-card { width: min(380px, 100%); background: var(--paper); border-radius: 18px; padding: 22px; display: grid; gap: 16px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; box-shadow: 0 24px 60px rgba(10, 16, 34, 0.35); }
.sgr-shell .sgr-name { font: 600 14px/1.1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; text-align: center; }
.sgr-shell .sgr-result { display: grid; justify-items: center; gap: 2px; }
.sgr-shell .sgr-lbl { font: 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.sgr-shell .sgr-score { font: 300 44px/1.05 var(--sans); letter-spacing: -0.02em; }
.sgr-shell .sgr-note { font: 12px/1 var(--mono); color: var(--muted); }
.sgr-shell .sgr-msg { margin: 0; text-align: center; color: #a3312a; font-size: 14px; }
.sgr-shell .sgr-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sgr-shell .sgr-mode { display: grid; gap: 4px; justify-items: center; padding: 14px 8px; border-radius: 12px; border: 0; cursor: pointer; background: var(--chip); color: var(--ink); }
.sgr-shell .sgr-mode b { font: 600 13px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }
.sgr-shell .sgr-mode span { font: 11.5px/1 var(--mono); color: var(--muted); }
.sgr-shell .sgr-ranked { background: var(--ink); color: var(--paper); }
.sgr-shell .sgr-ranked span { color: #c9cfe0; }
.sgr-shell .sgr-solo, .sgr-shell .sgr-resume { grid-column: 1 / -1; }
/* the controls: one per row, the keys on the left and what they do on the right, aligned in two columns; nothing
   breaks mid-phrase (owner, 2026-10-20: the line breaks and spill-overs) */
.sgr-shell .sgr-keys { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; border-top: 1px solid #e3e5ea; padding-top: 14px; }
.sgr-shell .sgr-keys div { display: contents; }
.sgr-shell .sgr-keys dt { font: 12px/1.5 var(--mono); white-space: nowrap; }
.sgr-shell .sgr-keys dd { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.sgr-shell.sgr-loading .sgr-modes .sgr-mode { opacity: 0.45; cursor: progress; }
.sgr-shell.sgr-loading .sgr-msg::after { content: "…"; }
.sgr-shell .sgr-mode.sgr-pick { box-shadow: inset 0 0 0 2px var(--ink); }   /* the mode Enter starts (the one clicked in the lobby); both look alike otherwise */
.sgr-shell .sgr-mode:focus-visible, .sgr-shell .sgr-btn:focus-visible { outline: 2px solid #2c5fb3; outline-offset: 2px; }
.sgr-shell .sgr-signin { text-decoration: none; }

/* the chip: AL DUNLAPOLY's own chip (games/al-dunlapoly/index.html, .chip), used for amounts everywhere */
.sgr-shell .chip { display: inline-block; width: 0.95em; height: 0.95em; margin-right: 0.22em; vertical-align: -0.14em; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='15.5' fill='%23c9a35a'/%3E%3Ccircle cx='16' cy='16' r='13.2' fill='none' stroke='%231d4a2c' stroke-width='4.4' stroke-dasharray='4.15 2.76'/%3E%3Ccircle cx='16' cy='16' r='9.6' fill='%231d4a2c'/%3E%3Cpath d='M11.6 22.4V9.6h2.3l4.4 8V9.6h2.1v12.8h-2.3l-4.4-8v8z' fill='%23e9cf8f'/%3E%3C/svg%3E") center / contain no-repeat; }
.sgr-shell .sgr-claim { grid-column: 1 / -1; background: var(--ink); color: var(--paper); }
.sgr-shell .sgr-claim span { color: #c9cfe0; }
.sgr-shell .sgr-bal .chip { margin-right: 6px; }
.sgr-shell .sgr-mode .chip, .sgr-shell .sgr-bal .chip { width: 1.15em; height: 1.15em; vertical-align: -0.24em; }
.sgr-shell .sgr-mode { grid-auto-flow: column; justify-content: center; align-items: center; gap: 10px; white-space: nowrap; }
@media (max-width: 480px) { .sgr-shell .sgr-modes { grid-template-columns: 1fr; } }
.sgr-shell .sgr-mode { min-width: 0; }

/* the mode buttons, settled: the mode on the left, its price on the right */
.sgr-shell .sgr-modes { gap: 10px; }
.sgr-shell .sgr-mode { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 48px; padding: 0 16px; border-radius: 12px; }
.sgr-shell .sgr-mode b { font: 600 13px/1 var(--sans); letter-spacing: 0.08em; }
.sgr-shell .sgr-mode span { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--mono); }
.sgr-shell .sgr-mode span .chip { margin: 0; width: 16px; height: 16px; vertical-align: 0; }
.sgr-shell .sgr-solo { justify-content: center; gap: 12px; }
.sgr-shell .sgr-modes { grid-template-columns: 1fr; }   /* stacked: each button keeps its mode and price on one line */
/* Ranked and Practice look the same, as on the site (owner, 2026-10-19) */
.sgr-shell .sgr-ranked { background: var(--chip); color: var(--ink); }
.sgr-shell .sgr-ranked span { color: var(--muted); }
.sgr-shell .sgr-mode:hover { background: #e6e8ee; }
/* each button as wide as its own words, never clipped */
.sgr-shell .sgr-mode { min-width: max-content; height: auto; min-height: 48px; }

/* the game's numbers: one style in every game, under the bar on the left */
.sgr-shell .sgr-hud { position: absolute; z-index: 2; top: calc(58px + env(safe-area-inset-top, 0px)); left: max(12px, env(safe-area-inset-left, 0px));
  display: flex; gap: 8px; pointer-events: none; }
.sgr-shell .sgr-hud:empty { display: none; }
.sgr-shell .sgr-hud div { display: grid; gap: 3px; padding: 8px 12px; border-radius: 12px; background: rgba(253, 253, 251, 0.92); box-shadow: 0 1px 6px rgba(10, 16, 34, 0.18); min-width: 64px; }
.sgr-shell .sgr-hud span { font: 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.sgr-shell .sgr-hud b { font: 500 18px/1.1 var(--mono); color: var(--ink); }
.sgr-shell.open .sgr-hud { display: none; }

/* after a run: today's leaderboard for this listing, the player's own row marked */
.sgr-shell .sgr-board { display: grid; gap: 8px; border-top: 1px solid #e3e5ea; padding-top: 12px; }
.sgr-shell .sgr-board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sgr-shell .sgr-pool { font: 12px/1 var(--mono); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.sgr-shell .sgr-board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sgr-shell .sgr-board li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.sgr-shell .sgr-board li span:first-child { font: 12px/1.6 var(--mono); color: var(--muted); }
.sgr-shell .sgr-board li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sgr-shell .sgr-board li b { font: 500 12px/1.6 var(--mono); }
.sgr-shell .sgr-board li.sgr-me { background: rgba(79, 70, 165, 0.12); box-shadow: inset 3px 0 0 var(--tchips); }
.sgr-shell .sgr-board li.sgr-me span:nth-child(2) { font-weight: 600; }
.sgr-shell .sgr-board .sgr-gap, .sgr-shell .sgr-board .sgr-none { display: block; color: var(--muted); font-size: 12px; padding: 2px 8px; }
/* a guest, after a run: sign in to keep the scores */
.sgr-shell .sgr-guest { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--chip); font-size: 13px; line-height: 1.4; }
.sgr-shell .sgr-guest[hidden] { display: none; }
.sgr-shell .sgr-guest .sgr-signin { background: var(--ink); color: var(--paper); box-shadow: none; width: auto; height: auto; padding: 8px 14px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
/* achievements: a card drops in at the top when one is reached, and leaves after a few seconds */
.sgr-shell .sgr-pops { position: absolute; z-index: 3; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100% - 24px)); display: grid; gap: 8px; pointer-events: none; }
.sgr-shell .sgr-pop { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 16px 10px 10px;
  background: var(--paper); border-radius: 16px; box-shadow: 0 12px 36px rgba(10, 16, 34, 0.32), inset 0 0 0 2px var(--metal);
  opacity: 0; transform: translateY(-16px) scale(0.96); transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
.sgr-shell .sgr-pop.in { opacity: 1; transform: none; }
/* (over a game's canvas the pop-up moves only by transform and opacity, on its own layer, and its picture has no filter:
   a drop-shadow there was redrawn on every frame of the animation; 2026-10-26) */
.sgr-shell .sgr-pop { will-change: transform, opacity; }
.sgr-shell .sgr-pop img { width: 64px; height: 64px; object-fit: contain; will-change: transform; }
.sgr-shell .sgr-pop.in img { animation: sgr-badge 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes sgr-badge { from { transform: scale(0.4) rotate(-14deg); } to { transform: none; } }
.sgr-shell .sgr-pop div { display: grid; gap: 1px; min-width: 0; }
.sgr-shell .sgr-pop b { font-size: 16px; }
.sgr-shell .sgr-pop span:last-child:not(.sgr-lbl) { font-size: 13px; color: var(--muted); }
.sgr-shell .sgr-bronze { --metal: #b8692f; } .sgr-shell .sgr-silver { --metal: #a9adb5; } .sgr-shell .sgr-gold { --metal: #d9a227; }
@media (prefers-reduced-motion: reduce) { .sgr-shell .sgr-pop, .sgr-shell .sgr-pop.in img { transition: opacity 0.2s; animation: none; transform: none; } }

/* embedded in a post (?embed=1): a small square, so the card starts below the bar, the game's name shows once (in the
   card, before a run), and everything is a little tighter; the card scrolls if it still doesn't fit */
.sgr-shell.sgr-embed .sgr-title { visibility: hidden; }
.sgr-shell.sgr-embed .sgr-menu { padding-top: calc(60px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; }
.sgr-shell.sgr-embed .sgr-card { padding: 14px 16px; gap: 10px; }
/* after a run: the score in its place */
.sgr-shell.sgr-embed .sgr-card:has(.sgr-result:not([hidden])) .sgr-name { display: none; }
.sgr-shell.sgr-embed .sgr-score { font-size: 34px; }
.sgr-shell.sgr-embed .sgr-mode { height: 42px; }
.sgr-shell.sgr-embed .sgr-keys { padding-top: 10px; gap: 4px 18px; }
.sgr-shell.sgr-embed .sgr-card:has(.sgr-result:not([hidden])) .sgr-keys { display: none; }   /* (after a run: room for the board) */
/* (embedded: an achievement shows small, at the foot of the square, so the score above stays in view) */
.sgr-shell.sgr-embed .sgr-pops { top: auto; bottom: 10px; }
.sgr-shell.sgr-embed .sgr-pop { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 6px 12px 6px 6px; }
.sgr-shell.sgr-embed .sgr-pop img { width: 40px; height: 40px; }
.sgr-shell.sgr-embed .sgr-pop b { font-size: 14px; }
.sgr-shell .sgr-save { grid-column: 1 / -1; justify-content: center; background: #4f46a5; color: #fdfdfb; text-decoration: none; }   /* (embedded: to the site, as this guest) */
/* embedded, after a run: everything in view at once in a ~340 px square, "Save your score" right above Ranked: the
   score on one line, tighter leaderboard rows, Ranked and Practice side by side (the mode over its price) */
.sgr-shell.sgr-embed .sgr-result { grid-auto-flow: column; justify-content: center; align-items: baseline; gap: 10px; }
.sgr-shell.sgr-embed .sgr-score { font-size: 28px; }
.sgr-shell.sgr-embed .sgr-board { gap: 4px; padding-top: 8px; }
.sgr-shell.sgr-embed .sgr-board li { padding: 2px 8px; }
.sgr-shell.sgr-embed .sgr-card:has(.sgr-result:not([hidden])) .sgr-modes { grid-template-columns: 1fr 1fr; gap: 8px; }
.sgr-shell.sgr-embed .sgr-card:has(.sgr-result:not([hidden])) .sgr-modes .sgr-mode { flex-direction: column; justify-content: center; gap: 4px; height: 52px; padding: 0 8px; }
.sgr-shell.sgr-embed .sgr-save { height: 40px; }

/* after a run: the XP it earned, a level reached, the boxes it found (src/xp.js, src/boxes.js). Rarities in the box's
   own colours (D11, the vault cube): common grey, rare green, legendary gold */
.sgr-shell .sgr-gains { display: grid; gap: 8px; }
.sgr-shell .sgr-xp { display: grid; gap: 6px; }
.sgr-shell .sgr-xp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sgr-shell .sgr-xp-head b { font: 500 14px/1 var(--mono); color: var(--tchips); }
.sgr-shell .sgr-xp-head span { font: 12px/1 var(--mono); color: var(--muted); }
.sgr-shell .sgr-xpbar { height: 6px; border-radius: 3px; background: #e3e5ea; overflow: hidden; }
.sgr-shell .sgr-xpbar i { display: block; height: 100%; width: 0; background: var(--tchips); border-radius: 3px; }
.sgr-shell .sgr-up { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(79, 70, 165, 0.12); box-shadow: inset 3px 0 0 var(--tchips); font-size: 14px; }
.sgr-shell .sgr-up b { font-weight: 600; }
.sgr-shell .sgr-box { --rc: #5d6573; --rg: rgba(150, 160, 180, 0.45); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 10px 14px 10px 10px; border-radius: 14px;
  background: radial-gradient(120px 90px at 42px 50%, color-mix(in srgb, var(--rg) 55%, transparent), transparent), var(--chip); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 28%, transparent);
  animation: sgr-boxin .5s cubic-bezier(.2, 1.4, .4, 1) both .25s; }
.sgr-shell .sgr-box[data-r="rare"] { --rc: #0f6b45; --rg: rgba(61, 255, 154, 0.45); }
.sgr-shell .sgr-box[data-r="legendary"] { --rc: #a87a1e; --rg: rgba(255, 200, 80, 0.6); }
.sgr-shell .sgr-box .bpic { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.sgr-shell .sgr-box .bpic::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; background: radial-gradient(closest-side, var(--rg), transparent);
  animation: sgr-boxglow 1.6s ease-in-out infinite; }
.sgr-shell .sgr-box .bpic img { position: relative; width: 58px; height: 58px; filter: drop-shadow(0 3px 4px rgba(10, 16, 34, 0.25)); }
.sgr-shell .sgr-box div { display: grid; gap: 3px; min-width: 0; }
.sgr-shell .sgr-box b { font: 600 16px/1.15 var(--sans); color: var(--rc); }
.sgr-shell .sgr-box span:last-child { font: 12px/1.3 var(--mono); color: var(--muted); }
.sgr-shell .sgr-box.sgr-box-guest { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; }
.sgr-shell .sgr-box .sgr-signin { background: var(--ink); color: var(--paper); box-shadow: none; width: auto; height: auto; padding: 9px 14px; border-radius: 999px;
  font: 600 13px/1 var(--sans); white-space: nowrap; }
@keyframes sgr-boxin { from { opacity: 0; transform: scale(.92); } }
@keyframes sgr-boxglow { 50% { opacity: .55; transform: scale(.9); } }
.sgr-shell .sgr-lv { font: 500 10px/1 var(--mono); padding: 3px 5px; border-radius: 999px; background: var(--chip); color: var(--muted); margin-left: 6px; }
.sgr-shell .sgr-board li.sgr-me .sgr-lv { background: rgba(253, 253, 251, 0.7); }
.sgr-shell .sgr-pop .lvpop { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(79, 70, 165, 0.12); color: var(--tchips); font: 500 24px/1 var(--mono); }
.sgr-shell .sgr-xpmetal { --metal: var(--tchips); }
.sgr-shell .sgr-boxpop { --metal: #8a92a0; } .sgr-shell .sgr-boxpop.sgr-r-rare { --metal: #1f9a63; } .sgr-shell .sgr-boxpop.sgr-r-legendary { --metal: #d9a227; }
@media (prefers-reduced-motion: reduce) { .sgr-shell .sgr-box, .sgr-shell .sgr-box .bpic::before { animation: none; } }
/* phones: pop-ups (achievements, a level, a box) drop in below the bar, never over it */
@media (max-width: 600px) { .sgr-shell .sgr-pops { top: calc(58px + env(safe-area-inset-top, 0px)); } }

/* the loading cover (src/server.js puts it in every game page; bootDone in shell.js lifts it once the game can play):
   the listing's picture blurred, its name and a moving line, as the lobby's own loader, so opening a game from the lobby
   is one continuous screen. It lifts itself after 30 s whatever happens, so a page is never stuck behind it. */
.sgr-boot { position: fixed; inset: 0; z-index: 2147483000; background: #0b1020; overflow: hidden; transition: opacity 0.35s ease; animation: sgr-boot-out 0.35s 30s forwards; }
.sgr-boot.gone { opacity: 0; pointer-events: none; }
.sgr-boot-bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(22px) brightness(0.5); }
.sgr-boot-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px; color: #fdfdfb; }
.sgr-boot-load b { font: 600 clamp(18px, 2.6vw, 28px)/1.1 "Hanken Grotesk", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; padding-inline: 24px; }
.sgr-boot-bar { width: min(240px, 60vw); height: 3px; border-radius: 3px; background: rgba(253, 253, 251, 0.18); overflow: hidden; }
.sgr-boot-bar i { display: block; width: 40%; height: 100%; border-radius: 3px; background: #fdfdfb; animation: sgr-boot-bar 1.1s ease-in-out infinite; }
@keyframes sgr-boot-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes sgr-boot-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .sgr-boot-bar i { animation-duration: 3s; } }
/* Watch & download this run (owner, 2026-10-27, 10-28): after a finished ranked run, its replay page in a new tab; outlined, under the run's score and gains */
.sgr-shell .sgr-share { display: grid; }
.sgr-shell .sgr-share .sgr-sharebtn { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); justify-content: center; }
/* a shared replay played to its end (replayEnd): the game, the player and the score, then Replay and, below it, Play the
   game, each the card's full width */
.sgr-shell.sgr-watched .sgr-modes { grid-template-columns: 1fr; }
.sgr-shell.sgr-watched.sgr-embed .sgr-card:has(.sgr-result:not([hidden])) .sgr-modes { grid-template-columns: 1fr; }   /* (embedded in a post too) */
.sgr-shell.sgr-watched .sgr-mode { justify-content: center; text-decoration: none; }
/* DOWNLOAD's progress (replayOpen): a thin bar along the top while the run is recorded */
.sgr-shell.sgr-recbar { position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 1001; }
.sgr-shell .sgr-rec { height: 100%; background: rgba(253, 253, 251, 0.28); }
.sgr-shell .sgr-rec i { display: block; height: 100%; width: 0; background: #e0453a; }
