Files
Zebratic 02a90e839c Initial scaffold: Beat Pocket MV3 extension
- manifest.json with MV3 config, host permissions for beat-battle.net
- content/detector.ts: route + overlay observer, emits bbp:phase events
- content/layout.ts: defensive mobile-first layout reflow
- content/chat-drawer.ts: bottom-sheet drawer, dispatches synthetic events
  through site's own React-managed textarea + button (preserves auth,
  rate-limit, mute, profanity guards)
- content/util/selectors.ts: text- and role-based fallback chain
- content/util/ws-proxy.ts: lightweight WebSocket instrumentation, no
  payload capture
- content/inject.css: mobile overrides using site's existing --bb-* vars
- background.js: MV3 service worker stub
- package.json + tsconfig.json + esbuild.config.mjs: build pipeline
- icons/: 16/32/48/128 placeholder PNGs (chili-red disc)
- docs/PLAN.md: full V1 architecture, risks, scope
- README.md: scope, dev workflow (load unpacked), tech
2026-07-11 02:24:37 +00:00

283 lines
6.1 KiB
CSS

/**
* inject.css — Mobile-first overrides.
*
* Strategy:
* - Respect the site's existing CSS custom properties (--bb-accent, --bb-bg,
* --bb-surface, etc). Don't fight the theme.
* - Single column at < 768px. Hide sidebars that don't have a mobile design.
* - Make tap targets >= 44x44 px (Apple HIG floor).
* - Disable scroll bounce inside .bb-room-overlay where they already
* thought about it.
* - Anything we don't know how to restyle gets left alone — selective
* coverage is safer than a global override disaster.
*/
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
@media (max-width: 900px) {
/* Home / lobby list: single column, no fixed-position side panels */
.bb-sidebar,
.bb-leaderboard-side,
.bb-right-rail,
[data-bb-leaderboard-side] {
display: none !important;
}
/* Menu items: bigger, easier to tap */
.bb-menu-item,
[data-bb-menu-item] {
min-height: 56px !important;
font-size: 1.05rem !important;
padding-top: 0.85rem !important;
padding-bottom: 0.85rem !important;
}
/* Footer nav: make room for our chat-drawer FAB */
.bb-footer-nav-main-fade {
padding-bottom: env(safe-area-inset-bottom) !important;
}
/* Login chip: pin top-right, doesn't compete with menu */
.bb-login-chip {
top: max(8px, env(safe-area-inset-top)) !important;
right: max(8px, env(safe-area-inset-right)) !important;
z-index: 60 !important;
}
/* In-game overlay: leave their outer scroll, but */
.bb-room-overlay {
padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
}
/* Make sure dialogs don't go off screen */
.bb-modal,
[role="dialog"] {
max-width: 100vw !important;
margin: 0 !important;
}
}
/* -------------------- Beat Pocket injected DOM -------------------- */
:root {
--bbp-accent: var(--bb-accent, #ff4d3d);
--bbp-bg: var(--bb-bg, #0a0a0a);
--bbp-surface: var(--bb-surface, #141414);
--bbp-ink: var(--bb-ink, #f5f5f5);
--bbp-border: var(--bb-border, #2a2a2a);
--bbp-fab-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
#bbp-host {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 9999;
font-family: inherit;
}
#bbp-host * {
box-sizing: border-box;
}
/* FAB */
.bbp-fab {
pointer-events: auto;
position: fixed;
right: max(14px, env(safe-area-inset-right));
bottom: calc(72px + env(safe-area-inset-bottom));
width: 56px;
height: 56px;
border-radius: 50%;
background: var(--bbp-accent);
color: #fff;
border: 2px solid #000;
font-size: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
box-shadow: var(--bbp-fab-shadow);
cursor: pointer;
touch-action: manipulation;
font-weight: 700;
transition: transform 120ms ease-out;
}
.bbp-fab:active {
transform: scale(0.92);
}
.bbp-fab[aria-expanded="true"] {
background: var(--bbp-surface);
color: var(--bbp-accent);
}
.bbp-fab__badge {
position: absolute;
top: -4px;
right: -4px;
min-width: 20px;
height: 20px;
border-radius: 999px;
background: #fff;
color: #000;
font-size: 11px;
font-weight: 800;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 5px;
border: 2px solid #000;
}
/* Backdrop */
.bbp-backdrop {
pointer-events: auto;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0);
transition: background 180ms ease-out;
z-index: 1;
}
.bbp-backdrop[data-open="true"] {
background: rgba(0, 0, 0, 0.45);
}
/* Bottom sheet */
.bbp-sheet {
pointer-events: auto;
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
background: var(--bbp-surface);
color: var(--bbp-ink);
border-top: 2px solid var(--bbp-border);
border-radius: 18px 18px 0 0;
transform: translateY(100%);
transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
display: flex;
flex-direction: column;
max-height: 85vh;
padding-bottom: env(safe-area-inset-bottom);
font-family: inherit;
box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
}
.bbp-sheet[data-state="peek"] {
transform: translateY(calc(100% - 64px));
}
.bbp-sheet[data-state="open"] {
transform: translateY(0);
}
.bbp-sheet__handle {
width: 44px;
height: 5px;
border-radius: 999px;
background: var(--bbp-border);
margin: 8px auto 0;
}
.bbp-sheet__head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 16px 12px;
border-bottom: 1px solid var(--bbp-border);
}
.bbp-sheet__title {
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
font-size: 0.85rem;
color: var(--bbp-ink);
}
.bbp-sheet__close {
background: transparent;
color: var(--bbp-ink);
border: none;
font-size: 22px;
padding: 6px 10px;
cursor: pointer;
}
.bbp-sheet__peek-preview {
padding: 12px 16px;
font-size: 0.9rem;
color: var(--bbp-ink);
opacity: 0.85;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.bbp-sheet__scroll {
flex: 1;
overflow-y: auto;
padding: 8px 12px;
-webkit-overflow-scrolling: touch;
}
.bbp-msg {
padding: 8px 10px;
border-radius: 8px;
font-size: 0.92rem;
line-height: 1.35;
}
.bbp-msg + .bbp-msg {
margin-top: 4px;
}
.bbp-msg__author {
font-weight: 700;
margin-right: 6px;
}
.bbp-msg__time {
opacity: 0.5;
font-size: 0.75rem;
margin-left: 6px;
}
.bbp-composer {
border-top: 1px solid var(--bbp-border);
display: flex;
gap: 8px;
padding: 10px 12px;
background: var(--bbp-bg);
}
.bbp-composer textarea {
flex: 1;
resize: none;
min-height: 40px;
max-height: 120px;
border: 1px solid var(--bbp-border);
background: var(--bbp-bg);
color: var(--bbp-ink);
border-radius: 8px;
padding: 8px 10px;
font: inherit;
font-size: 0.95rem;
}
.bbp-composer button {
background: var(--bbp-accent);
color: #fff;
border: 2px solid #000;
font-weight: 800;
letter-spacing: 0.06em;
padding: 0 14px;
border-radius: 8px;
cursor: pointer;
text-transform: uppercase;
font-size: 0.8rem;
}
.bbp-composer button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Hide Beat Pocket FAB when the site explicitly shows its own chat UI */
body.bbp-hide-fab .bbp-fab {
display: none;
}