:root { --blb-handoff: #050302; }   /* = GAMES.quake.handoff in blb-site/site/js/main.js */
:root { color-scheme: dark; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: Verdana, Arial, sans-serif; color: #f90; }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: #000; outline: none; object-fit: contain; }

#game.locked { cursor: none; }
#busy { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; padding: 10px 22px; background: rgba(0, 0, 0, .8);
  border: 1px solid #f90; color: #fc3; letter-spacing: 3px; pointer-events: none; }
#busy[hidden] { display: none; }
#netmsg { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 8; padding: 8px 18px; background: rgba(0, 0, 0, .8);
    border: 1px solid #f90; color: #fc3; letter-spacing: 2px; pointer-events: none; }
#netmsg[hidden] { display: none; }
/* cursor debugging (on by default for now, ?cursordebug=0 turns it off) */
#dbgRing { position: fixed; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid #0f0; border-radius: 50%;
  z-index: 9; pointer-events: none; box-sizing: border-box; }
#dbgRing::after { content: ''; position: absolute; left: 8px; top: 8px; width: 2px; height: 2px; background: #0f0; }
#dbgRing.free { border-color: #f0f; }
#dbgText { position: fixed; left: 6px; bottom: 6px; z-index: 9; margin: 0; padding: 4px 6px; background: rgba(0, 0, 0, .75); color: #0f0;
  font: 12px/1.35 Consolas, monospace; pointer-events: none; white-space: pre; }
#dbgRing[hidden], #dbgText[hidden] { display: none; }
#gear { position: fixed; right: calc(var(--ui-right, 0px) + 10px); top: 10px; z-index: 4; padding: 4px 10px; font-size: 22px; letter-spacing: 0; opacity: .55; }
#gear:hover, #gear:focus-visible, #gear.hot { opacity: 1; background: #f90; color: #000; }
#settings { position: fixed; right: calc(var(--ui-right, 0px) + 10px); top: 56px; z-index: 5; width: min(300px, calc(100vw - 20px)); box-sizing: border-box; padding: 14px;
  background: rgba(0, 0, 0, .92); border: 1px solid #f90; display: flex; flex-direction: column; gap: 12px; color: #fc3; font-size: 14px; }
#settings h2 { margin: 0; font-size: 16px; letter-spacing: 4px; font-weight: normal; color: #f90; }
#settings label { display: flex; flex-direction: column; gap: 4px; }
#settings select { background: #000; color: #fc3; border: 1px solid #f90; padding: 4px; font: inherit; }
#settings input[type=range] { accent-color: #f90; }
#settings button { padding: 8px 14px; letter-spacing: 2px; }
#settings[hidden], #gear[hidden] { display: none; }
#diag { position: fixed; left: 6px; top: 6px; z-index: 3; margin: 0; padding: 4px 6px; background: rgba(0, 0, 0, .6);
  color: #6f6; font: 12px/1.35 Consolas, monospace; pointer-events: none; white-space: pre; }
#diag[hidden] { display: none; }
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: #000; z-index: 2; text-align: center; padding: 16px;
}
.screen[hidden] { display: none; }
h1 { margin: 0; font-size: 34px; letter-spacing: 6px; color: #f90; font-weight: normal; }
#status { margin: 0; color: #fc3; min-height: 1.4em; }
.bar { width: min(420px, 80vw); height: 10px; border: 1px solid #f90; }
.bar[hidden] { display: none; }
#bar { height: 100%; width: 0; background: #f90; }
button {
  background: #000; color: #fc3; border: 1px solid #f90; padding: 10px 40px; font: inherit; letter-spacing: 3px; cursor: pointer;
}
button:hover, button:focus-visible { background: #f90; color: #000; outline: none; }
button[hidden] { display: none; }
#picker[hidden], #report[hidden] { display: none; }
#picker { max-width: min(560px, 92vw); }
.hint { margin: 0 0 14px; color: #fc3; line-height: 1.5; font-size: 14px; }
.hint.dim { color: #a60; }
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; border: 1px solid #f90; color: #fc3; padding: 10px 28px; letter-spacing: 3px; cursor: pointer; }
.btn:hover, .btn:focus-within { background: #f90; color: #000; }
#report { list-style: none; margin: 0; padding: 0; max-width: min(620px, 92vw); text-align: left; font-size: 14px; line-height: 1.5; }
#report li.ok { color: #6c6; }
#report li.warn { color: #fc3; }
#report li.bad { color: #f66; }
button.link { border: 0; padding: 4px; letter-spacing: 0; font-size: 12px; color: #a60; text-decoration: underline; }
button.link:hover, button.link:focus-visible { background: none; color: #fc3; }
.screen.drop { outline: 2px dashed #f90; outline-offset: -12px; }
pre#failure { max-width: min(760px, 92vw); max-height: 40vh; overflow: auto; text-align: left; color: #f66; white-space: pre-wrap; margin: 0; }
pre#failure[hidden] { display: none; }

/* lobby panel (lobby.js): sits under the gear, in the 4:3 area's top-right like the settings panel */
#lobBtn { position: fixed; right: calc(var(--ui-right, 0px) + 60px); top: 10px; z-index: 4; padding: 7px 12px; font-size: 13px; letter-spacing: 2px; opacity: .55; }
#lobBtn:hover, #lobBtn:focus-visible, #lobBtn.hot { opacity: 1; background: #f90; color: #000; }
#lobby { position: fixed; right: calc(var(--ui-right, 0px) + 10px); top: 56px; z-index: 6; width: min(380px, calc(100vw - 20px)); max-height: calc(100vh - 70px); overflow: auto;
  box-sizing: border-box; padding: 14px; background: rgba(0, 0, 0, .94); border: 1px solid #f90; display: flex; flex-direction: column; gap: 12px; color: #fc3; font-size: 14px; }
#lobby h2 { margin: 0; font-size: 16px; letter-spacing: 4px; font-weight: normal; color: #f90; }
#lobby label { display: flex; flex-direction: column; gap: 4px; }
#lobby input, #lobby select { background: #000; color: #fc3; border: 1px solid #f90; padding: 5px; font: inherit; }
#lobby button { padding: 7px 12px; letter-spacing: 2px; font-size: 13px; }
#lobby section { display: flex; flex-direction: column; gap: 10px; }
#lobby .tabs { display: flex; gap: 8px; }
#lobby .tabs button.on { background: #f90; color: #000; }
#lobby .codeRow { display: flex; flex-direction: column; gap: 8px; }
#lobby .bar2 { display: flex; justify-content: space-between; align-items: center; }
#lobby .lobRow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid #630; }
#lobby .hint { margin: 0; font-size: 13px; }
#lobby .bad { color: #f66; margin: 0; }
#lobby .lobCode { font-size: 30px; letter-spacing: 8px; color: #f90; text-align: center; }
#lobby .row { gap: 8px; }
#lobby[hidden], #lobBtn[hidden], #lobby [hidden] { display: none; }

/* hub (hub.js). Palette from ioq3 code/q3_ui/ui_qmenu.c: normal #ff6e00, highlight #ffff00, disabled #808080, list bar rgba(255,110,0,.3).
   Team Arena skin: steel blue. */
.hub { --hover: rgba(255, 110, 0, .3); --c: #ff6e00; --hi: #ffff00; --dim: #808080; --bar: rgba(255, 110, 0, .3); --line: #ff6e00; width: min(560px, 94vw); max-height: 72vh; overflow: auto; text-align: left; }
/* Team Arena (ui/main.menu): white text, focus colour 1 .75 0 = #ffbf00, buttons are blue bars (0 0 .75 .25) with a grey border and turn red (.75 0 0 .25) on hover */
.hub.ta { --c: #ffffff; --hi: #ffbf00; --dim: #909090; --bar: rgba(0, 0, 191, .25); --line: #808080; --hover: rgba(191, 0, 0, .25); }
#hub[hidden] { display: none; }
.hub button { color: var(--c); border-color: var(--line); }
.hub button:hover, .hub button:focus-visible { background: var(--hover); color: var(--hi); outline: none; }
.hub .hubTitle { margin: 0 0 14px; text-align: center; font-size: 22px; letter-spacing: 6px; font-weight: normal; color: var(--c); }
.hub .gamePick { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.hub .gamePick button { padding: 6px 14px; font-size: 12px; letter-spacing: 2px; }
.hub .gamePick button.on { background: var(--c); color: #000; }
.hub .hubList { display: flex; flex-direction: column; gap: 8px; }
.hub .hubList button { text-align: center; font-size: 18px; letter-spacing: 4px; border: 0; background: none; padding: 9px 20px; }
.hub .hubList button .sum { display: block; font-size: 11px; letter-spacing: 1px; color: var(--dim); }
.hub .hubList button.dim { color: var(--dim); }
.hub .hubHead { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.hub .hubHead h2 { margin: 0; font-size: 18px; letter-spacing: 5px; font-weight: normal; color: var(--c); }
.hub .backBtn { padding: 5px 14px; font-size: 12px; letter-spacing: 2px; }
.hub .hubForm { display: flex; flex-direction: column; gap: 10px; color: var(--c); font-size: 14px; }
.hub .hubForm label { display: flex; flex-direction: column; gap: 4px; }
.hub .hubForm label[hidden] { display: none; }
.hub .hubForm label.chk { flex-direction: row; align-items: center; gap: 8px; }
.hub .hubForm input, .hub .hubForm select { background: #000; color: var(--hi); border: 1px solid var(--line); padding: 5px; font: inherit; }
.hub .hubForm input[type=range] { padding: 0; accent-color: var(--c); }
.hub .hubForm input[type=checkbox] { accent-color: var(--c); }
.hub .hubForm output { color: var(--dim); font-size: 12px; }
.hub .hubForm button.primary { padding: 10px; letter-spacing: 4px; font-size: 16px; background: var(--bar); }
.hub .hint { color: var(--c); }
.hub .hint.dim { color: var(--dim); }
.hub .bad { color: #f66; margin: 0; }
.hub .codeRow { display: flex; flex-direction: column; gap: 8px; }
.hub .bar2 { display: flex; justify-content: space-between; align-items: center; }
.hub .lobRow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.hub .pick .lab { display: block; margin-bottom: 4px; }
.hub .portraits { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; max-height: 240px; overflow: auto; }
.hub .portraits button { padding: 3px; letter-spacing: 0; font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hub .portraits button.on { background: var(--bar); border-color: var(--hi); color: var(--hi); }
.hub .portraits .ph { width: 64px; height: 64px; background: #111 center / cover no-repeat; display: block; image-rendering: auto; }

/* bitmap font + menu art (skin.js). --font/--menuback/--u are set on #start; glyph cells are 8x16 (small) or 16x16 (big) at scale --u */
#start.skinned { background-color: #000; background-image: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .55)), var(--menuback, none); background-position: center; background-size: contain; background-repeat: no-repeat; }
#start { --gw: 8; }
#start h1, .hub h2, .hub .hubList > button, .hub button.primary { --gw: 16; }
.hub .hubList .sum { --gw: 8; }
#start .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#start .bw { display: inline-block; white-space: nowrap; }
#start .bsp { display: inline-block; width: calc(var(--gw) * var(--u, 1) * 1px); height: calc(16px * var(--u, 1)); font-size: 0; vertical-align: top; }
#start .bg { display: inline-block; vertical-align: top; width: calc(var(--gw) * var(--u, 1) * 1px); height: calc(16px * var(--u, 1)); background: currentColor;
  -webkit-mask-image: var(--font); mask-image: var(--font); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: calc(var(--gw) * 16 * var(--u, 1) * 1px) calc(256px * var(--u, 1)); mask-size: calc(var(--gw) * 16 * var(--u, 1) * 1px) calc(256px * var(--u, 1));
  -webkit-mask-position: calc(var(--cx) * var(--gw) * var(--u, 1) * -1px) calc(var(--cy) * 16px * var(--u, 1) * -1); mask-position: calc(var(--cx) * var(--gw) * var(--u, 1) * -1px) calc(var(--cy) * 16px * var(--u, 1) * -1); }

