/* Brass & Soot game styles, all scoped under .bs-game (and .bs-gallery) so the game can sit inside any page. */
.bs-game, .bs-gallery { --ink: #140c1c; --soot: #2b1d33; --iron: #5a5670; --steam: #d8dee8; --brass: #d8a040; --brass-hi: #f8e088; }
.bs-game { color: var(--steam); font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--ink); padding: 6px; border-radius: 6px; }
.bs-game *, .bs-gallery * { box-sizing: border-box; }
.bs-game #screen:focus { outline: none; }
.bs-game #screen:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.bs-game #screen { max-width: 1024px; }
.bs-game #view { position: relative; }
.bs-game #stage { display: block; width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; background: #000; border: 2px solid var(--soot); }
.bs-game #overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; background: rgba(20, 12, 28, .78); }
.bs-game #overlay[hidden] { display: none; }
.bs-game #overlay h3 { margin: 0; color: var(--brass); font-size: clamp(18px, 4vw, 34px); letter-spacing: 4px; }
.bs-game #overlay p { margin: 0; color: var(--steam); font-size: clamp(11px, 1.8vw, 16px); }
.bs-game #overlay small { color: #8a8a9e; letter-spacing: 2px; }
.bs-game #overlay.title { justify-content: flex-end; padding-bottom: 7%; background: none; }
.bs-game #overlay .blink { color: var(--brass-hi); animation: bs-blink 1s steps(2) infinite; }
@keyframes bs-blink { 50% { opacity: 0 } }
.bs-game #toast { position: absolute; top: 6%; left: 50%; transform: translateX(-50%); padding: 2px 10px; background: var(--soot); border: 1px solid var(--brass); color: var(--brass-hi); font-size: clamp(11px, 1.6vw, 15px); white-space: nowrap; opacity: 0; transition: opacity .3s; pointer-events: none; }
.bs-game #toast.show { opacity: 1; }
.bs-game #hud { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 8px 0; color: var(--brass-hi); }
.bs-game #goal { color: var(--steam); }
.bs-game #fs, .bs-game #mute { position: absolute; top: 6px; right: 6px; z-index: 3; display: flex; padding: 6px; border: 1px solid var(--iron); border-radius: 4px; background: rgba(43, 29, 51, .7); color: var(--brass-hi); cursor: pointer; }
.bs-game #mute { right: 46px; }
/* touch pad: shown once the device reports a touch screen */
.bs-game #pad { display: none; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.touch .bs-game #pad { display: flex; }
.bs-game #dpad, .bs-game #pad .acts { display: flex; gap: 10px; }
.bs-game #pad .btn { display: flex; align-items: center; justify-content: center; width: min(64px, 19vw); height: min(64px, 19vw); border: 2px solid var(--iron); border-radius: 50%; background: rgba(43, 29, 51, .6); color: var(--steam); font: bold 11px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }
.bs-game #dpad .btn { border-radius: 12px; font-size: 20px; }
.bs-game #pad .btn.on { background: var(--brass); border-color: var(--brass-hi); color: var(--ink); }
.touch .bs-game #overlay { cursor: pointer; }
/* fullscreen: the Fullscreen API where available, a fixed full-viewport layer otherwise (iPhone Safari) */
body.bs-noscroll { overflow: hidden; }
.bs-game #screen.full { position: fixed; inset: 0; z-index: 1000; max-width: none; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.bs-game #screen.full #view { width: min(100vw, calc(100vh * 16 / 9)); width: min(100vw, calc(100dvh * 16 / 9)); }
.bs-game #screen.full #stage { border: 0; }
/* In fullscreen the canvas HUD carries steam and goals; the text HUD stays for screen readers. */
.bs-game #screen.full #hud, .bs-game .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bs-game #screen.full #pad { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); pointer-events: none; }
.bs-game #screen.full #pad > * { pointer-events: auto; }
.bs-gallery .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.bs-gallery .cell { background: var(--soot); border-radius: 4px; padding: 8px; text-align: center; }
.bs-gallery .cell canvas { image-rendering: pixelated; display: block; margin: 0 auto 6px; max-width: 100%; height: auto; }
.bs-gallery .cell span { font-size: 11px; color: #8a8a9e; word-break: break-all; }
.bs-game #err { color: #e8681c; white-space: pre-wrap; }
.bs-gallery .anim-toggle { font: 13px/1 ui-monospace, Menlo, Consolas, monospace; padding: 6px 10px; border: 1px solid var(--iron); border-radius: 4px; background: var(--soot); color: var(--brass-hi); cursor: pointer; }
