/* =====================================================================================
   FragBlocks front-end UI (menus, lobby, results, pause, toasts, screen transitions).
   Blocky pixel style: stepped pixel wedges and square blocks, sticker cards with hard black outlines and offset shadows,
   tape labels, diagonal stripe backgrounds, chunky type. HUD styling lives in style.css.
   ===================================================================================== */
:root {
  --ink-pink: #ff2fa0; --ink-lime: #c8ff1a; --ink-teal: #18e0d0; --ink-yellow: #ffd21a; --ink-orange: #ff7a1a; --ink-purple: #7a3cff;
  --ink-black: #0c0814; --paper: #f7f3ea; --paper-2: #ebe4d4; --deep: #1a0f33; --deep-2: #2a1650;
  /* dark surfaces + light text (cards, rows, inputs); black text stays only on coloured ink fills */
  --panel: #1b1230; --panel-2: #261a44; --panel-3: #33255a; --text: #f4efff; --text-dim: #a99cc2; --pink-lt: #ff5cb8;
  --display: "Bungee", "Arial Black", Impact, sans-serif;
  --lcd: "Silkscreen", "VT323", ui-monospace, monospace;
  --body: "Rubik", "Segoe UI", system-ui, sans-serif;
  --outline: 3px solid var(--ink-black);
  --drop: 6px 6px 0 var(--ink-black);
}

/* ---------------------------------------------------------------- screens + animated background */
.screen.fb {
  display: block; padding: 0; overflow-y: auto; overflow-x: hidden; font-family: var(--body);
  background: linear-gradient(180deg, rgba(26,15,51,.84), rgba(12,8,20,.9)), url(img/ui/pattern.png) 0 0 / 384px repeat; image-rendering: auto;
}
.screen.fb::before {   /* scrolling diagonal stripes */
  content: ""; position: fixed; inset: -50%; z-index: -1; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(-30deg, rgba(255,255,255,.035) 0 28px, transparent 28px 56px);
  animation: stripes 22s linear infinite;
}
.screen.fb::after {    /* square pixel grid fading in from the corners */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' shape-rendering='crispEdges'%3E%3Crect width='3' height='3' fill='%23ff2fa0' fill-opacity='.45'/%3E%3Crect x='9' y='9' width='3' height='3' fill='%2318e0d0' fill-opacity='.4'/%3E%3C/svg%3E");
  background-size: 18px 18px;
  -webkit-mask: radial-gradient(circle at 0 100%, #000, transparent 45%), radial-gradient(circle at 100% 0, #000, transparent 40%);
  mask: radial-gradient(circle at 0 100%, #000, transparent 45%), radial-gradient(circle at 100% 0, #000, transparent 40%);
}
@keyframes stripes { to { transform: translate(112px, 0); } }
.fb .bgpix { position: fixed; z-index: -1; pointer-events: none; background: no-repeat center / contain; image-rendering: pixelated; animation: pixin .5s steps(5) both; }
.fb .bgpix.blocks { opacity: .9; animation: pixin .5s steps(5) both, blockbob 3.2s steps(4) infinite .5s; }
.fb .bgpix.blocks.slow { animation: pixin .5s steps(5) both, blockbob 4.4s steps(4) infinite .7s; }
@keyframes pixin { from { opacity: 0; clip-path: inset(100% 0 0 0); } }
@keyframes blockbob { 50% { translate: 0 -12px; } }
/* Higgsfield key art behind the menu (fades into the dark left side where the logo and player card sit) */
#menu { background: linear-gradient(90deg, rgba(12,8,20,.96) 0%, rgba(12,8,20,.86) 30%, rgba(12,8,20,.35) 62%, rgba(12,8,20,.15) 100%), url(img/ui/keyart.webp) right center / cover no-repeat, #1a0f33; }
#lobby { background: linear-gradient(180deg, rgba(26,15,51,.82), rgba(12,8,20,.9)), url(img/ui/keyart.webp) center / cover no-repeat, #1a0f33; }
#results { background: linear-gradient(180deg, rgba(12,8,20,.35) 0%, rgba(12,8,20,.78) 38%, rgba(12,8,20,.94) 70%), url(img/ui/victory.webp) center top / cover no-repeat, #1a0f33; }

/* ---------------------------------------------------------------- shared pieces */
.fb, .fb button, .fb input { font-family: var(--body); }
.sticker {
  position: relative; background: var(--panel); color: var(--text); border: var(--outline); border-radius: 18px 22px 16px 24px;
  box-shadow: var(--drop), inset 0 0 0 2px rgba(255,255,255,.06); padding: 26px 20px 18px;
}
.fb .card { margin-bottom: 18px; }
.sticker .muted, .sticker .small.muted { color: var(--text-dim); }
.tape {
  position: absolute; top: -16px; left: 18px; transform: rotate(-3deg); z-index: 2;
  font-family: var(--display); font-size: 15px; letter-spacing: 1px; color: var(--ink-black);
  background: var(--ink-yellow); border: var(--outline); padding: 3px 14px 2px; border-radius: 4px; box-shadow: 3px 3px 0 var(--ink-black);
}
.tape.pink { background: var(--ink-pink); color: #fff; } .tape.teal { background: var(--ink-teal); } .tape.lime { background: var(--ink-lime); } .tape.yellow { background: var(--ink-yellow); }

.btn {
  font-family: var(--display) !important; font-size: 15px; letter-spacing: .5px; color: var(--text); background: var(--panel-3);
  border: var(--outline); border-radius: 999px; padding: 9px 20px 8px; box-shadow: 4px 4px 0 var(--ink-black);
  cursor: pointer; transition: transform .12s cubic-bezier(.2,1.8,.4,1), box-shadow .12s, filter .12s; text-transform: uppercase;
}
.btn:hover:not(:disabled) { transform: translate(-1px,-2px) rotate(-1.5deg) scale(1.03); box-shadow: 6px 7px 0 var(--ink-black); }
.btn:active:not(:disabled) { transform: translate(3px,3px) scale(.97); box-shadow: 1px 1px 0 var(--ink-black); }
.btn:disabled { opacity: .5; filter: grayscale(.6); cursor: not-allowed; }
.btn.lime { background: var(--ink-lime); color: var(--ink-black); } .btn.pink { background: var(--ink-pink); color: #fff; } .btn.teal { background: var(--ink-teal); color: var(--ink-black); }
.btn.danger { background: #ff4b5c; color: #fff; }
.btn.big { font-size: 20px; padding: 12px 30px 11px; }
.fb .btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.fb .btns.center, .btns.center { justify-content: center; }

.fb input {
  font-family: var(--display); font-size: 18px; color: var(--text); background: var(--panel-2); border: var(--outline);
  border-radius: 10px; padding: 8px 12px; margin-top: 6px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35);
}
.fb input:focus { outline: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35), 0 0 0 4px var(--ink-pink); }
.fld { display: block; font-family: var(--lcd); font-size: 13px; color: var(--text-dim); margin: 0 0 12px; }

/* segmented choices as chunky chips */
.fb .seg { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.fb .seg button {
  font-family: var(--display); font-size: 13px; color: var(--text); background: var(--panel-3); border: 2.5px solid var(--ink-black);
  border-radius: 10px; padding: 5px 11px 4px; box-shadow: 2px 2px 0 var(--ink-black); transition: transform .1s;
}
.fb .seg button:hover:not(:disabled) { transform: translateY(-2px); }
.fb .seg button.on { background: var(--ink-pink); color: #fff; transform: rotate(-2deg); }
.fb .seg button:disabled { text-decoration: line-through; opacity: .35; }
.fb .seg.big button { font-size: 16px; padding: 8px 16px 7px; }
.fb .seg.big button.on { background: var(--ink-teal); color: var(--ink-black); }
.fb .field { font-family: var(--lcd); font-size: 13px; color: var(--text-dim); margin: 12px 0 0; }

.fb .math {
  font-family: var(--body); font-size: 14px; line-height: 1.6; color: var(--text);
  background: repeating-linear-gradient(-45deg, var(--panel-2) 0 10px, #2a1d4a 10px 20px); border: 2.5px dashed rgba(255,255,255,.3);
  border-radius: 12px; padding: 12px 14px; margin: 14px 0;
}
.fb .math b { color: var(--pink-lt); } .fb .math .warn { color: #ffa04a; font-weight: 700; } .fb .math .muted { color: var(--text-dim); }
.fb .small { font-size: 12px; }

/* ---------------------------------------------------------------- main menu */
.menu-grid { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 36px; max-width: 1240px; margin: 0 auto; padding: 34px 28px 40px; align-items: start; }
.logo-wrap { margin: 0 0 6px; }
.logo-wrap img.logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)); animation: logobob 4s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes logobob { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(-1deg) translateY(-6px); } }
.tagline { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 22px; }
.tagline span { font-family: var(--lcd); font-size: 13px; color: #fff; background: var(--ink-black); border: 2px solid var(--ink-teal); padding: 3px 8px; border-radius: 6px; transform: rotate(-1deg); }
.tagline span:nth-child(2) { border-color: var(--ink-pink); transform: rotate(1deg); }
.tagline span:nth-child(3) { border-color: var(--ink-yellow); }
#quickplay { width: 100%; font-size: 28px; padding: 18px 20px 16px; margin-bottom: 30px; transform: rotate(-1.5deg); }
#quickplay:hover { transform: rotate(-3deg) scale(1.04); }
#quickplay::after { content: " ▶"; font-size: 22px; }
#walletstatus { font-weight: 700; margin-bottom: 6px; }
#walletstatus a { color: var(--pink-lt); }

.tabs { display: flex; gap: 8px; margin: 6px 0 -6px 12px; position: relative; z-index: 3; flex-wrap: wrap; }
.tabs button {
  font-family: var(--display); font-size: 16px; color: var(--text-dim); background: #100a1e; border: var(--outline); border-bottom: none;
  border-radius: 14px 14px 0 0; padding: 10px 18px 12px; transform: translateY(6px); transition: transform .12s, background .12s;
}
.tabs button:hover { transform: translateY(2px); color: var(--text); }
.tabs button.on { background: var(--panel); color: var(--text); transform: translateY(3px); }
.tabs button.on:nth-child(1) { box-shadow: inset 0 6px 0 var(--ink-lime); }
.tabs button.on:nth-child(2) { box-shadow: inset 0 6px 0 var(--ink-pink); }
.tabs button.on:nth-child(3) { box-shadow: inset 0 6px 0 var(--ink-teal); }
#roomcount { font-family: var(--lcd); font-size: 12px; opacity: .7; }
.tabpane { border-radius: 4px 22px 18px 22px; min-height: 320px; }

#roomlist { display: grid; gap: 12px; }
.fb .room {
  position: relative; display: grid; grid-template-columns: 116px 1fr auto; gap: 14px; align-items: center; background: var(--panel-2); color: var(--text);
  border: 2.5px solid var(--ink-black); border-radius: 14px; padding: 10px 12px 10px 0; box-shadow: 3px 3px 0 var(--ink-black); overflow: hidden;
  transition: transform .12s;
}
.fb .room.fresh { animation: rowin .35s cubic-bezier(.2,1.4,.4,1) both; }
.fb .room:hover { transform: translateX(4px) rotate(-.4deg); }
.fb .room .swatch { align-self: stretch; margin: -10px 0; background: var(--ink-teal); border-right: 2.5px solid var(--ink-black); }
.fb .room.paid .swatch { background: var(--ink-yellow); }
.fb .room .t { font-family: var(--display); font-size: 16px; line-height: 1.15; }
.fb .room .m { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.fb .room .m i { font-style: normal; font-family: var(--lcd); font-size: 11px; color: var(--text-dim); background: var(--panel); border: 1.5px solid rgba(255,255,255,.18); border-radius: 6px; padding: 1px 6px; }
.fb .room .m i.live { background: var(--ink-pink); color: #fff; }
.fb .room .m i.pool { background: var(--ink-lime); color: var(--ink-black); border-color: var(--ink-black); }
.fb .room .m i.live { border-color: var(--ink-black); }
.fb .badge { font-family: var(--display); font-size: 11px; letter-spacing: .5px; padding: 2px 7px; border-radius: 5px; border: 2px solid var(--ink-black); margin-right: 8px; vertical-align: 2px; }
.fb .badge.free { background: var(--ink-teal); color: var(--ink-black); }
.fb .badge.paid { background: var(--ink-yellow); color: var(--ink-black); }
.fb .room .btn { font-size: 14px; padding: 8px 16px 7px; }
@keyframes rowin { from { opacity: 0; transform: translateY(14px) rotate(1deg); } }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.formgrid .wide { grid-column: 1 / -1; }
#create { width: 100%; }
.ctrlgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px; margin-bottom: 14px; }
.ctrlgrid div { display: flex; align-items: center; gap: 5px; font-weight: 700; }
.ctrlgrid span { margin-left: 6px; }
kbd {
  font-family: var(--lcd); font-size: 12px; min-width: 30px; text-align: center; padding: 5px 7px 4px; background: var(--panel-3); color: var(--text);
  border: 2.5px solid var(--ink-black); border-radius: 7px; box-shadow: 0 3px 0 var(--ink-black);
}

/* ---------------------------------------------------------------- lobby */
.lobby-wrap { max-width: 1080px; margin: 0 auto; padding: 46px 24px 40px; }
.banner { position: relative; text-align: center; margin-bottom: 34px; }
.banner .tape { position: relative; display: inline-block; top: 0; left: 0; font-size: 18px; margin-bottom: 8px; }
.banner h2 { font-family: var(--display); font-size: clamp(26px, 4.6vw, 54px); color: #fff; margin: 0; line-height: 1.05;
  -webkit-text-stroke: 2px var(--ink-black); text-shadow: 4px 5px 0 var(--ink-black), 0 0 30px rgba(255,47,160,.45); }
.fb .statebadge { display: inline-block; margin-top: 14px; font-family: var(--display); font-size: 16px; color: var(--ink-black); background: var(--ink-lime);
  border: var(--outline); border-radius: 999px; padding: 6px 18px 5px; box-shadow: 3px 3px 0 var(--ink-black); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06) rotate(-1deg); } }
.lobby-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; }
.fb .plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 6px 0 0; }
.fb .plist div { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; background: var(--panel-2); color: var(--text);
  border: 2.5px solid var(--ink-black); border-radius: 12px; padding: 8px 10px; box-shadow: 3px 3px 0 var(--ink-black); font-size: 14px; }
.fb .plist div.fresh { animation: rowin .35s both; }
.fb .plist .pc { grid-row: 1 / 3; width: 30px; height: 30px; border: 2.5px solid var(--ink-black); border-radius: 8px; transform: rotate(-6deg); }
.fb .plist .pn { font-family: var(--display); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb .plist .ps { font-family: var(--lcd); font-size: 11px; }
.fb .plist .ok { color: var(--ink-lime); } .fb .plist .no { color: var(--text-dim); }
.fb #l-note { margin-top: 8px; }

/* ---------------------------------------------------------------- results */
.results-wrap { max-width: 1120px; margin: 0 auto; padding: 30px 22px 40px; }
.res-title { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 6vw, 72px); text-align: center; margin: 0 0 18px; color: var(--ink-lime);
  -webkit-text-stroke: 2.5px var(--ink-black); text-shadow: 5px 6px 0 var(--ink-black); transform: rotate(-2deg); animation: slam .5s cubic-bezier(.2,1.6,.4,1) both; }
.res-title span { color: var(--ink-pink); }
@keyframes slam { from { transform: scale(1.8) rotate(-8deg); opacity: 0; } }
#r-hero { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 18px; align-items: end; margin: 52px 0 24px; }
.pod { position: relative; text-align: center; color: var(--text); background: var(--panel); border: var(--outline); border-radius: 18px 18px 8px 8px;
  box-shadow: var(--drop); padding: 26px 12px 14px; animation: podin .55s cubic-bezier(.2,1.5,.4,1) both; }
.pod.p1 { order: 2; padding-top: 44px; background: linear-gradient(180deg, #4a3812, var(--panel) 62%); animation-delay: .15s; }
.pod.p2 { order: 1; animation-delay: .3s; } .pod.p3 { order: 3; animation-delay: .45s; }
@keyframes podin { from { transform: translateY(60px) scale(.9); opacity: 0; } }
.pod .rank { color: var(--ink-black); position: absolute; top: -26px; left: 50%; transform: translateX(-50%) rotate(-6deg); width: 54px; height: 54px; line-height: 50px;
  font-family: var(--display); font-size: 26px; background: var(--ink-yellow); border: var(--outline); border-radius: 6px; box-shadow: 3px 3px 0 var(--ink-black); }
.pod.p2 .rank { background: #d9dde6; } .pod.p3 .rank { background: #f0a868; }
.pod.p1 .rank { width: 66px; height: 66px; line-height: 62px; font-size: 32px; top: -34px; }
.pod .crown { position: absolute; top: -58px; left: 50%; transform: translateX(-50%) rotate(-6deg); font-size: 30px; }
.pod .cube { width: 46px; height: 46px; margin: 0 auto 8px; border: var(--outline); border-radius: 10px; transform: rotate(-8deg); box-shadow: 3px 3px 0 var(--ink-black); }
.pod.p1 .cube { width: 60px; height: 60px; }
.pod .nm { font-family: var(--display); font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pay { font-family: var(--display); font-size: 30px; color: var(--pink-lt); margin: 4px 0; }
.pod.p1 .pay { font-size: 40px; }
.pod .kd { font-family: var(--lcd); font-size: 12px; color: var(--text-dim); }
.pod.me { box-shadow: var(--drop), 0 0 0 5px var(--ink-lime); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--ink-black); border: 3px solid var(--ink-black); border-radius: 14px; padding: 10px 12px; text-align: center; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.12) inset; }
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; }
.stat i { font-style: normal; font-family: var(--lcd); font-size: 11px; color: #c9c1d6; }
.stat:nth-child(1) b { color: var(--ink-lime); } .stat:nth-child(2) b { color: var(--ink-orange); } .stat:nth-child(3) b { color: var(--ink-teal); }
.stat:nth-child(4) b { color: var(--ink-pink); } .stat:nth-child(5) b { color: var(--ink-yellow); }
.table-card { padding: 10px 10px 6px; }
.fb #r-table { overflow-x: auto; }
.fb table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; color: var(--text); }
.fb th { font-family: var(--lcd); font-size: 11px; font-weight: 400; color: var(--text-dim); border: none; padding: 2px 10px; text-align: right; }
.fb td { background: var(--panel-2); border-top: 2.5px solid var(--ink-black); border-bottom: 2.5px solid var(--ink-black); padding: 8px 10px; text-align: right; white-space: nowrap; font-weight: 700; }
.fb td:first-child { border-left: 2.5px solid var(--ink-black); border-radius: 10px 0 0 10px; font-family: var(--display); text-align: center; }
.fb td:last-child { border-right: 2.5px solid var(--ink-black); border-radius: 0 10px 10px 0; }
.fb th:nth-child(2), .fb td:nth-child(2) { text-align: left; }
.fb td .sw { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink-black); border-radius: 4px; margin-right: 8px; vertical-align: -2px; transform: rotate(-8deg); }
.fb tr.me td { background: #2f3d12; }
.fb td .muted { color: var(--text-dim); }
.fb td.pos, .fb td.neg { font-family: var(--display); font-weight: 400; }
.fb td.pos span, .fb td.neg span { display: inline-block; padding: 2px 8px; border: 2px solid var(--ink-black); border-radius: 8px; }
.fb td.pos span { background: var(--ink-lime); color: var(--ink-black); } .fb td.neg span { background: #ffd0d6; color: #a3002a; }
.fb tbody tr, .fb table tr { animation: rowin .35s both; }
#r-sigs { color: #fff; text-align: center; margin-top: 8px; }
#r-sigs .muted { color: #c9c1d6; }
#r-sigs a { color: var(--ink-lime); }

/* ---------------------------------------------------------------- pause menu */
#pausemenu { background: rgba(12,8,20,.6); backdrop-filter: blur(3px); font-family: var(--body); }
#pausemenu .panel.sticker { max-width: 460px; text-align: center; padding-top: 30px; }
#pausemenu .tape { left: 50%; transform: translateX(-50%) rotate(-3deg); }
#pausemenu h2 { font-family: var(--display); font-size: 40px; margin: 0 0 6px; color: var(--text); }
#pausemenu .muted { color: var(--text-dim); }
#pausemenu #p-note { color: var(--pink-lt); font-weight: 700; }
#pausemenu .btns { justify-content: center; gap: 14px; }
#pausemenu .btns .btn { min-width: 170px; }

/* ---------------------------------------------------------------- toasts */
#toast div { font-family: var(--body); font-weight: 700; color: var(--text); background: var(--panel); border: var(--outline); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink-black); padding: 9px 16px; animation: toastin .35s cubic-bezier(.2,1.6,.4,1) both; }
#toast div.err { background: #ff4b5c; color: var(--ink-black); border-color: var(--ink-black); }
#toast a { color: var(--pink-lt); font-weight: 900; } #toast div.err a { color: var(--ink-black); }
@keyframes toastin { from { transform: translateY(30px) scale(.8) rotate(4deg); opacity: 0; } }

/* ---------------------------------------------------------------- stepped pixel-block screen transition (js/pixelwipe.js) */
#inkwipe { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
#inkwipe svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#inkwipe.on { pointer-events: all; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .menu-grid { grid-template-columns: 1fr; gap: 10px; padding: 20px 16px 30px; }
  .logo-wrap img.logo { max-width: 460px; margin: 0 auto; }
  .lobby-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat:first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .formgrid { grid-template-columns: 1fr; }
  #r-hero { grid-template-columns: 1fr; gap: 30px; }
  .pod.p1, .pod.p2, .pod.p3 { order: initial; }
  .tabs button { font-size: 13px; padding: 8px 12px 10px; }
  #quickplay { font-size: 22px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .menu-grid { grid-template-columns: 300px 1fr; gap: 18px; padding: 14px 16px; }
  #quickplay { font-size: 20px; padding: 12px; margin-bottom: 20px; }
  .tagline { margin-bottom: 12px; }
  .results-wrap, .lobby-wrap { padding-top: 16px; }
  #r-hero { margin: 30px 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.fb::before, .logo-wrap img.logo, .fb .statebadge, .fb .bgpix { animation: none; }
  .fb *, #toast > * { animation-duration: .01ms !important; animation-delay: 0s !important; }
}

/* ---------------------------------------------------------------- graphics settings */
.fb .gfx, #pausemenu .gfx { margin: 8px 0 4px; text-align: left; }
.fb .gfx .res-now, #pausemenu .gfx .res-now { color: var(--ink-lime); margin-left: 6px; }
#pausemenu .gfx .seg { justify-content: center; }
#pausemenu .gfx .seg button { font-family: var(--display); font-size: 13px; color: var(--text); background: var(--panel-3); border: 2.5px solid var(--ink-black);
  border-radius: 10px; padding: 5px 11px 4px; box-shadow: 2px 2px 0 var(--ink-black); }
#pausemenu .gfx .seg button.on { background: var(--ink-teal); color: var(--ink-black); }
.fb .gfx .seg button.on { background: var(--ink-teal); color: var(--ink-black); }
#pausemenu .gfx .fld { color: var(--text-dim); font-family: var(--lcd); font-size: 13px; }
#fpsmeter { display: none; position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 60; pointer-events: none;
  font: 12px var(--lcd); color: var(--ink-lime); background: rgba(12,8,20,.75); border: 1.5px solid rgba(255,255,255,.15); border-radius: 6px; padding: 2px 8px; }

/* ---------------------------------------------------------------- map picker: names left, preview right */
.fb .mappick { display: grid; grid-template-columns: minmax(170px, 0.8fr) 1.4fr; gap: 14px; margin-top: 6px; align-items: start; }
.fb .seg.maplist { flex-direction: column; flex-wrap: nowrap; margin-top: 0; gap: 6px; }
.fb .seg.maplist button { text-align: left; width: 100%; }
.fb .seg.maplist button.on { transform: translateX(6px) rotate(-1deg); }
.fb .mapprev { margin: 0; position: relative; border: 3px solid var(--ink-black); border-radius: 12px; overflow: hidden; background: #0c0814; box-shadow: 4px 4px 0 var(--ink-black); aspect-ratio: 16 / 9; }
.fb .mapprev img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.fb .mapprev img.in { opacity: 1; }
.fb .mapprev figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 9px; background: linear-gradient(transparent, rgba(8,5,16,.92) 45%); }
.fb .mapprev figcaption b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; color: #fff; }
.fb .mapprev figcaption span { display: block; font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.35; color: var(--text-dim); margin-top: 2px; }
@media (max-width: 700px) { .fb .mappick { grid-template-columns: 1fr; } .fb .seg.maplist { flex-direction: row; flex-wrap: wrap; } }

/* ---------------------------------------------------------------- players-online card (menu) */
#onlinecard { padding-top: 20px; }
#onlinecard .online-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
#onlinecard .online-head b { font-family: var(--display); font-size: 28px; color: var(--ink-lime); line-height: 1; }
#onlinecard canvas { width: 100%; height: auto; display: block; border: var(--outline); border-radius: 6px; image-rendering: pixelated; }
#onlinecard .online-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
#onlinecard .online-foot a { font-family: var(--display); font-size: 12px; color: var(--ink-lime); text-decoration: none; white-space: nowrap; }
#onlinecard .online-foot a:hover { color: var(--pink-lt); }

/* ---------------------------------------------------------------- room list section headings */
.roomhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 4px 10px; }
.roomhead:not(:first-child) { margin-top: 22px; }
.roomhead .rh-t { font-family: var(--display); font-size: 16px; letter-spacing: 1px; color: var(--ink-yellow); }
.roomhead.free .rh-t { color: var(--ink-teal); }
.roomhead .rh-t i { font-style: normal; font-family: var(--lcd); font-size: 12px; color: var(--text-dim); margin-left: 6px; }
.roomhead .rh-s { font-size: 13px; color: var(--text-dim); }

/* ---------------------------------------------------------------- room row map thumbnail (replaces the colour swatch) */
.fb .room .thumb { align-self: stretch; margin: -10px 0; position: relative; background: var(--ink-teal); border-right: 2.5px solid var(--ink-black); overflow: hidden; min-height: 72px; }
.fb .room.paid .thumb { background: var(--ink-yellow); }
.fb .room .thumb img { position: absolute; inset: 0 0 0 6px; width: calc(100% - 6px); height: 100%; object-fit: cover; display: block; }
@media (max-width: 560px) { .fb .room { grid-template-columns: 72px 1fr auto; } }

/* ---------------------------------------------------------------- ping */
.pingline { margin-top: 4px; color: var(--text-dim); }
.pingline b { font-weight: 700; }
.pingline .dot { display: inline-block; width: 9px; height: 9px; border: 2px solid var(--ink-black); margin-right: 6px; vertical-align: -1px; background: var(--text-dim); }
.good { color: var(--ink-lime) !important; } .ok { color: var(--ink-yellow) !important; } .bad { color: #ff5a5a !important; }
.pingline .dot.good { background: var(--ink-lime); } .pingline .dot.ok { background: var(--ink-yellow); } .pingline .dot.bad { background: #ff5a5a; }
.plist .pp { font-family: var(--lcd); font-size: 11px; margin-left: auto; margin-right: 8px; }
#hiping { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 40; pointer-events: none; font-family: var(--lcd); font-size: 13px;
  color: #fff; background: rgba(200, 30, 30, .85); border: 2px solid var(--ink-black); border-radius: 6px; padding: 2px 10px; letter-spacing: 1px; }

/* ---------------------------------------------------------------- title screen */
#title { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #1a0f33; }
#title.hidden { display: none; }
#title .t-bg { position: absolute; inset: 0; background: #1a0f33 url(img/ui/keyart.webp) center / cover; animation: t-zoom 18s ease-out both; }
#title .t-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(26,15,51,.5), rgba(12,8,20,.9) 75%); }
#title .t-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 16px; text-align: center; }
#title .t-logo { width: min(860px, 88vw); filter: drop-shadow(10px 12px 0 var(--ink-black)); animation: t-pop .5s cubic-bezier(.2,1.5,.4,1) both; }
#title .t-tag { font-family: var(--display); font-size: clamp(16px, 2.4vw, 30px); letter-spacing: 2px; color: var(--ink-black); background: var(--ink-teal);
  border: 4px solid var(--ink-black); border-radius: 8px; padding: 4px 18px 1px; box-shadow: 6px 6px 0 var(--ink-black); transform: rotate(-2deg); animation: t-up .4s .25s both; }
#title #t-start { font-size: clamp(26px, 3.6vw, 44px); padding: 14px 64px 10px; margin-top: 10px; animation: t-up .4s .4s both, t-pulse 1.6s 1s ease-in-out infinite; }
#title .t-hint { font-family: var(--lcd); font-size: 13px; color: var(--text-dim); letter-spacing: 1px; animation: t-up .4s .55s both; }
@keyframes t-zoom { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes t-pop { from { transform: scale(1.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes t-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes t-pulse { 50% { transform: scale(1.05); } }

/* ---------------------------------------------------------------- music toggle */
#musicbtn { position: fixed; top: 14px; right: 16px; z-index: 70; display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 13px;
  color: var(--ink-black); background: var(--ink-lime); border: 3px solid var(--ink-black); border-radius: 999px; padding: 6px 14px 4px; box-shadow: 4px 4px 0 var(--ink-black); cursor: pointer; }
#musicbtn .note { font-size: 18px; line-height: 1; }
#musicbtn.off { background: var(--panel-2); color: var(--text-dim); }
#musicbtn.off .note { text-decoration: line-through; }
#musicbtn.hidden { display: none; }

/* ---------------------------------------------------------------- live map pop-up */
#livemodal { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 28px 16px; background: rgba(12,8,20,.72); }
#livemodal.hidden { display: none; }
#livemodal .lm-box { position: relative; width: min(1080px, 100%); height: min(860px, 100%); background: var(--deep); border: var(--outline); border-radius: 14px; box-shadow: var(--drop); padding: 0; overflow: visible; }
#livemodal iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; display: block; background: var(--deep); }
#livemodal .lm-x { position: absolute; top: -14px; right: -14px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; font-weight: 900; line-height: 1;
  color: #fff; background: var(--ink-pink); border: 3px solid var(--ink-black); box-shadow: 3px 3px 0 var(--ink-black); cursor: pointer; }
#livemodal .lm-x:hover { transform: scale(1.08); }
