/* ============================================================
   BUILDBATTLE 3D — 3D building competition.
   Prefix: .bb-  ·  DOM ids: bb-*
   Reuses the global theme vars from styles.css. The room is an
   immersive full-screen overlay; HUD layers float over the canvas.
   ============================================================ */

[hidden] { display: none !important; }

#bb-lobby { min-height: 100%; }

/* ════════════════ LOBBY ════════════════ */
.bb-content { max-width: 1100px; margin: 0 auto; padding: 22px 20px 60px; }
.bb-topbar-actions { margin-left: auto; }

.bb-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  background:
    radial-gradient(120% 140% at 90% 0%, rgba(245, 158, 11, 0.18), transparent 55%),
    linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(34, 211, 238, 0.06));
  border: 1px solid var(--border-default);
  border-radius: 20px; padding: 26px 28px; margin-bottom: 26px;
  position: relative; overflow: hidden;
}
.bb-head::after {
  content: ""; position: absolute; right: -40px; bottom: -50px;
  width: 220px; height: 220px; opacity: 0.12; pointer-events: none;
  background: repeating-linear-gradient(45deg, var(--text-primary) 0 2px, transparent 2px 14px);
  transform: rotate(8deg);
}
.bb-head-badge {
  display: inline-block; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: #fcd34d; background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.32);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 12px;
}
.bb-head-titles h1 { font-size: 2.1rem; margin: 0 0 8px; letter-spacing: -0.5px; }
.bb-head-3d {
  background: linear-gradient(135deg, #f59e0b, #22d3ee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 900;
}
.bb-head-titles p { margin: 0; color: var(--text-secondary); max-width: 640px; line-height: 1.55; font-size: 0.95rem; }
.bb-head-tips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bb-head-tips span {
  font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-surface); border: 1px solid var(--border-default);
  padding: 5px 11px; border-radius: 999px;
}

/* Buttons */
.bb-btn {
  border: none; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 0.92rem; padding: 12px 20px;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
  color: var(--text-primary);
}
.bb-btn:hover { transform: translateY(-1px); }
.bb-btn:active { transform: translateY(0); }
.bb-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.bb-btn-primary { background: linear-gradient(135deg, var(--primary-500), var(--accent-500)); }
.bb-btn-primary:hover { filter: brightness(1.08); }
.bb-btn-ghost { background: var(--bg-elevated); border: 1px solid var(--border-default); }
.bb-btn-sm { padding: 8px 14px; font-size: 0.84rem; }
.bb-btn-block { width: 100%; }
.bb-create { white-space: nowrap; }

.bb-rooms-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.bb-section-title { font-size: 1.05rem; margin: 0; }
.bb-count { color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
.bb-search { position: relative; }
.bb-search-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--text-muted); stroke-width: 2; }
.bb-search input {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: 10px; padding: 9px 14px 9px 34px; color: var(--text-primary);
  font-size: 0.9rem; width: 220px; outline: none;
}
.bb-search input:focus { border-color: var(--primary-400); }

.bb-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.bb-room-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform 0.14s ease, border-color 0.14s ease; }
.bb-room-card:hover { transform: translateY(-3px); border-color: var(--primary-400); }
.bb-room-card-top {
  height: 96px; display: flex; align-items: center; justify-content: center; position: relative;
  background-size: cover; overflow: hidden;
}
.bb-room-card-top::before {
  content: ""; position: absolute; inset: 0; opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 18px 18px; mask-image: linear-gradient(to top, transparent, #000);
}
.bb-room-card-emoji { font-size: 2.6rem; position: relative; z-index: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4)); }
.bb-card-state {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,0.55); color: #fff; backdrop-filter: blur(4px);
}
.bb-card-open { background: rgba(22, 199, 132, 0.85); }
.bb-room-card-body { padding: 14px 16px 16px; }
.bb-room-card-name { font-weight: 700; font-size: 1rem; margin-bottom: 3px; }
.bb-room-card-host { font-size: 0.82rem; color: var(--text-muted); }
.bb-room-card-bet { font-size: 0.8rem; color: #fcd34d; margin-top: 6px; font-weight: 600; }
.bb-room-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.bb-room-card-people { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }
.bb-room-card-join { font-size: 0.84rem; color: var(--primary-200); font-weight: 700; }
.bb-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 50px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bb-empty-ic { font-size: 2.4rem; }

/* ════════════════ IMMERSIVE ROOM ════════════════ */
.bb-room {
  position: fixed; inset: 0; z-index: 1200;
  background: #05060c; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.bb-stage { position: absolute; inset: 0; }
#bb-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.bb-crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 26px; height: 26px; pointer-events: none; z-index: 5;
}
.bb-crosshair::before, .bb-crosshair::after {
  content: ""; position: absolute; background: rgba(255,255,255,0.92);
  box-shadow: 0 0 2px rgba(0,0,0,0.95); border-radius: 2px;
}
.bb-crosshair::before { left: 50%; top: 2px; bottom: 2px; width: 2px; transform: translateX(-50%); }
.bb-crosshair::after { top: 50%; left: 2px; right: 2px; height: 2px; transform: translateY(-50%); }

/* top bar floating over the canvas */
.bb-topbar2 {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(5,6,12,0.85), transparent);
  pointer-events: none;
}
.bb-topbar2 > * { pointer-events: auto; }
.bb-room-back, .bb-pillbtn {
  background: rgba(20, 22, 34, 0.7); border: 1px solid var(--border-default);
  color: var(--text-primary); border-radius: 10px; padding: 8px 12px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(8px);
}
.bb-room-back:hover, .bb-pillbtn:hover { background: rgba(30, 33, 48, 0.85); }
.bb-topbar2-mid { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bb-room-emoji { font-size: 1.4rem; }
.bb-topbar2-titles { min-width: 0; }
.bb-room-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.bb-room-meta { font-size: 0.74rem; color: var(--text-muted); }
.bb-pillbtn { margin-left: auto; }

.bb-phase { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.bb-phase > * { pointer-events: auto; }

/* ── WAITING ── */
/* `margin:auto` on the card (instead of align/justify center) lets it center
   when it fits but scroll cleanly from the top when it's taller than the
   viewport — no clipped top on short mobile-landscape screens. */
.bb-waiting { display: flex; padding: 64px 16px 20px; overflow-y: auto; }
.bb-waiting-card {
  margin: auto;
  background: rgba(15, 17, 27, 0.92); border: 1px solid var(--border-default);
  border-radius: 22px; padding: 26px 26px; max-width: 460px; width: 100%; text-align: center;
  backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.bb-waiting-ic { font-size: 3rem; margin-bottom: 6px; }
.bb-waiting-card h2 { margin: 0 0 8px; font-size: 1.5rem; }
.bb-waiting-card > p { margin: 0 0 18px; color: var(--text-secondary); font-size: 0.92rem; }
.bb-players { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.bb-player-chip { display: flex; align-items: center; gap: 7px; background: var(--bg-surface); border: 1px solid var(--border-default); padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.bb-player-chip.is-host { border-color: rgba(245,158,11,0.5); }
.bb-player-chip.has-team { border-color: var(--tc); box-shadow: 0 0 0 1px var(--tc) inset; }
.bb-chip-team { font-size: 0.8rem; }

/* team picker (waiting room) */
.bb-teams { margin-bottom: 16px; }
.bb-teams-hint { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 9px; font-weight: 600; }
.bb-team-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bb-team-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--bg-surface); border: 1.5px solid var(--border-default);
  color: var(--text-primary); border-radius: 999px; padding: 7px 13px;
  font-size: 0.85rem; font-weight: 700; transition: transform 0.12s ease, border-color 0.12s ease;
}
.bb-team-btn:hover { transform: translateY(-1px); }
.bb-team-btn.is-mine { border-color: var(--tc); box-shadow: 0 0 0 2px var(--tc) inset, 0 0 16px -4px var(--tc); }
.bb-team-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 8px var(--tc); }
.bb-team-n { background: rgba(0,0,0,0.35); border-radius: 999px; padding: 1px 7px; font-size: 0.75rem; min-width: 18px; text-align: center; }

/* team standings (results) */
.bb-team-standings { margin-bottom: 22px; }
.bb-team-standings .bb-section-title { text-align: center; margin-bottom: 12px; }
.bb-team-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bb-team-rname { width: 116px; flex-shrink: 0; font-weight: 700; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-team-row.is-win .bb-team-rname { color: #fcd34d; }
.bb-team-bar { flex: 1; height: 18px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 999px; overflow: hidden; }
.bb-team-bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(.2,.8,.2,1); min-width: 5px; }
.bb-team-score { width: 86px; flex-shrink: 0; text-align: right; font-weight: 700; font-size: 0.8rem; color: var(--text-secondary); }
.bb-avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; color: #fff; overflow: hidden; flex-shrink: 0; }
.bb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bb-avatar.lg { width: 40px; height: 40px; font-size: 1rem; }
.bb-host-crown { font-size: 0.8rem; }
.bb-config { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.bb-config-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); }
.bb-config-row select { background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary); border-radius: 8px; padding: 7px 10px; font-size: 0.85rem; }
.bb-host-wait { color: var(--text-muted); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; justify-content: center; }
.bb-spin { width: 15px; height: 15px; border: 2px solid var(--border-default); border-top-color: var(--primary-400); border-radius: 50%; animation: bbspin 0.8s linear infinite; }
@keyframes bbspin { to { transform: rotate(360deg); } }

/* ── BUILDING HUD ── */
.bb-build-head {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  width: calc(100% - 24px); max-width: 760px; z-index: 5;
}
.bb-prompt-pill {
  background: rgba(15, 17, 27, 0.82); border: 1px solid rgba(245,158,11,0.4);
  border-radius: 999px; padding: 8px 16px; display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(8px); box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.bb-prompt-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 700; }
.bb-prompt-text { font-weight: 800; font-size: 1rem; color: #fcd34d; }
.bb-build-head-right { display: flex; align-items: center; gap: 8px; }
.bb-blockcount {
  background: rgba(15, 17, 27, 0.82); border: 1px solid var(--border-default);
  border-radius: 999px; padding: 7px 12px; font-size: 0.82rem; font-weight: 700; backdrop-filter: blur(8px);
}
.bb-timer {
  background: rgba(15, 17, 27, 0.82); border: 1px solid var(--border-default);
  border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 1rem;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(8px);
}
.bb-timer-low { color: #ff6b6b; border-color: rgba(255,107,107,0.5); animation: bbpulse 1s ease infinite; }
@keyframes bbpulse { 50% { transform: scale(1.06); } }
.bb-submit { padding: 8px 16px; font-size: 0.85rem; box-shadow: 0 6px 18px rgba(124,92,255,0.35); }

/* joystick (left) */
.bb-joy {
  position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: 110px;
  width: 116px; height: 116px; border-radius: 50%;
  background: radial-gradient(circle, rgba(20,22,34,0.5), rgba(20,22,34,0.28));
  border: 1.5px solid rgba(255,255,255,0.14); z-index: 5; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.bb-joy-knob {
  width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(124,92,255,0.95), rgba(124,92,255,0.6));
  border: 2px solid rgba(255,255,255,0.5); box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: transform 0.04s linear;
}
/* fly buttons (right) */
.bb-fly { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 120px; display: flex; flex-direction: column; gap: 12px; z-index: 5; }
.bb-fly-btn {
  width: 56px; height: 56px; border-radius: 16px; font-size: 1.2rem;
  background: rgba(20,22,34,0.6); border: 1.5px solid rgba(255,255,255,0.16); color: #fff;
  cursor: pointer; backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center;
}
.bb-fly-btn:active { background: rgba(124,92,255,0.5); transform: scale(0.94); }

/* bottom toolbar */
.bb-toolbar {
  position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 6; width: min(640px, calc(100% - 24px));
  background: rgba(12, 14, 22, 0.86); border: 1px solid var(--border-default);
  border-radius: 18px; padding: 10px; backdrop-filter: blur(12px); box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.bb-toolbar-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bb-modes { margin-bottom: 0; }
.bb-mode {
  background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-secondary);
  border-radius: 10px; padding: 8px 12px; font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.bb-mode.is-active { background: linear-gradient(135deg, var(--primary-500), var(--accent-500)); color: #fff; border-color: transparent; }
.bb-tool {
  background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary);
  width: 38px; height: 38px; border-radius: 10px; font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.bb-tool:hover { background: var(--bg-elevated); }
/* Each tool group is its own THIN single-line row (shapes / colors), so the
   panel stays short and covers as little of the build as possible. */
.bb-toolbar-collapsible { margin-top: 8px; display: flex; flex-direction: column; gap: 7px; }
.bb-toolbar.is-collapsed .bb-toolbar-collapsible { display: none; }
.bb-toolbar-section { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.bb-toolbar-label { flex-shrink: 0; width: 42px; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); font-weight: 700; }
.bb-shapes, .bb-colors { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; flex: 1; min-width: 0; padding: 1px 2px 3px; scrollbar-width: none; }
.bb-shapes::-webkit-scrollbar, .bb-colors::-webkit-scrollbar { height: 0; background: transparent; }
.bb-shape {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; padding: 0;
  background: var(--bg-surface); border: 1.5px solid var(--border-default);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; line-height: 1;
}
.bb-shape.is-active { border-color: var(--primary-400); background: rgba(124,92,255,0.18); box-shadow: 0 0 0 1px var(--primary-400) inset; }
.bb-color {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.bb-color.is-active { border-color: #fff; transform: scale(1.12); }
.bb-color-pick {
  flex-shrink: 0; position: relative; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border-default); color: var(--text-muted); font-size: 1rem; overflow: hidden;
}
.bb-color-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.bb-submitted-tag {
  position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
  z-index: 5; background: rgba(22,199,132,0.9); color: #04130c; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; font-size: 0.74rem; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.32); pointer-events: none;
  opacity: 1; transition: opacity 0.6s ease;
}
.bb-submitted-tag.is-faded { opacity: 0; }
.bb-help {
  position: absolute; left: 50%; bottom: 178px; transform: translateX(-50%);
  z-index: 4; background: rgba(12,14,22,0.7); border: 1px solid var(--border-default);
  border-radius: 10px; padding: 7px 14px; font-size: 0.76rem; color: var(--text-muted);
  display: flex; gap: 8px; align-items: center; max-width: calc(100% - 24px); text-align: center;
  backdrop-filter: blur(6px); transition: opacity 0.4s ease;
}
.bb-help strong { color: var(--text-secondary); }
.bb-help-touch { display: none; }
.bb-help.is-faded { opacity: 0; pointer-events: none; }

/* ── VOTING HUD ── */
.bb-vote-head {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center;
  background: rgba(12,14,22,0.82); border: 1px solid var(--border-default); border-radius: 14px;
  padding: 10px 18px; z-index: 5; backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.bb-vote-progress { font-weight: 800; font-size: 0.95rem; }
.bb-vote-prompt { font-size: 0.9rem; color: var(--text-secondary); }
.bb-vote-prompt strong { color: #fcd34d; }
.bb-vote-rotatehint {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%);
  z-index: 4; font-size: 0.82rem; color: var(--text-muted);
  background: rgba(12,14,22,0.6); padding: 6px 14px; border-radius: 999px; backdrop-filter: blur(6px);
  transition: opacity 0.5s ease;
}
.bb-vote-mine {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%);
  z-index: 5; background: rgba(245,158,11,0.92); color: #1a1203; font-weight: 700;
  padding: 9px 18px; border-radius: 999px; font-size: 0.88rem; white-space: nowrap;
}
.bb-vote-bar {
  position: absolute; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 6; display: flex; align-items: center; gap: 8px;
  background: rgba(12,14,22,0.9); border: 1px solid var(--border-default); border-radius: 16px;
  padding: 12px 16px; backdrop-filter: blur(12px); box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}
.bb-vote-hint { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; margin-right: 4px; }
.bb-vote-num {
  width: 50px; height: 50px; border-radius: 13px; font-size: 1.25rem; font-weight: 800; cursor: pointer;
  background: var(--bg-surface); border: 1.5px solid var(--border-default); color: var(--text-primary);
  transition: transform 0.12s ease, background 0.15s ease;
}
.bb-vote-num:hover { transform: translateY(-2px); border-color: var(--primary-400); }
.bb-vote-num.is-picked { background: linear-gradient(135deg, var(--primary-500), var(--accent-500)); color: #fff; border-color: transparent; transform: translateY(-2px) scale(1.04); }
.bb-vote-foot { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 5; font-size: 0.82rem; color: var(--text-muted); }

/* ── RESULTS ── */
.bb-results { background: rgba(5,6,12,0.92); overflow-y: auto; backdrop-filter: blur(4px); }
.bb-results-scroll { max-width: 920px; margin: 0 auto; padding: 64px 16px 30px; }
.bb-results-head { text-align: center; margin-bottom: 18px; }
.bb-results-head h2 { margin: 0 0 4px; font-size: 1.5rem; }
.bb-results-head p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; }
.bb-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin-bottom: 26px; }
.bb-podium-card {
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 16px;
  overflow: hidden; text-align: center; position: relative;
}
.bb-podium-card.rank-1 { border-color: rgba(245,158,11,0.6); box-shadow: 0 0 28px rgba(245,158,11,0.22); }
.bb-podium-card.rank-2 { border-color: rgba(203,213,225,0.5); }
.bb-podium-card.rank-3 { border-color: rgba(217,119,6,0.5); }
.bb-podium-medal { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 1.5rem; }
.bb-podium-mini { width: 100%; aspect-ratio: 1 / 1; display: block; background: radial-gradient(circle at 50% 30%, #1a1d2e, #0a0b14); }
.bb-podium-info { padding: 10px 10px 14px; }
.bb-podium-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; justify-content: center; }
.bb-podium-score { font-size: 0.82rem; color: #fcd34d; font-weight: 700; margin-top: 3px; }
.rank-1 .bb-podium-mini { aspect-ratio: 1 / 1.1; }
.bb-pot-banner {
  text-align: center; background: rgba(245,158,11,0.14); border: 1px solid rgba(245,158,11,0.4);
  color: #fcd34d; border-radius: 12px; padding: 12px; margin-bottom: 22px; font-weight: 700;
}
.bb-results-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bb-all-list, .bb-leaderboard { display: flex; flex-direction: column; gap: 8px; }
.bb-rank-row {
  display: flex; align-items: center; gap: 10px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: 10px; padding: 8px 12px;
}
.bb-rank-num { font-weight: 800; font-size: 0.9rem; color: var(--text-muted); width: 24px; text-align: center; }
.bb-rank-name { flex: 1; font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-rank-score { font-weight: 700; color: #fcd34d; font-size: 0.86rem; }
.bb-rank-row.is-me { border-color: var(--primary-400); background: rgba(124,92,255,0.1); }

/* ── rotate nudge ── */
.bb-rotate {
  position: absolute; inset: 0; z-index: 30; background: rgba(5,6,12,0.97);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px; gap: 6px;
}
.bb-rotate-ic { font-size: 4rem; animation: bbrotate 2s ease-in-out infinite; }
@keyframes bbrotate { 0%, 40% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.bb-rotate h3 { margin: 10px 0 4px; font-size: 1.4rem; }
.bb-rotate p { margin: 0; color: var(--text-secondary); max-width: 320px; }

/* ── create modal ── */
.bb-overlay { z-index: 1400; }
.bb-modal {
  max-width: 520px; position: relative;
  max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.bb-modal h3 { margin: 0 0 18px; }
.bb-modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.bb-field { margin-bottom: 14px; }
.bb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bb-row3 { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; align-items: end; }
.bb-emoji-input { text-align: center; font-size: 1.2rem; }
.bb-color-input { padding: 4px; height: 42px; cursor: pointer; }
.bb-grow { min-width: 0; }
.bb-field-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }
.bb-time-note { margin: -2px 0 14px; }
.bb-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ════════════════ RESPONSIVE ════════════════ */
@media (max-width: 560px) {
  .bb-head-titles h1 { font-size: 1.7rem; }
  .bb-rooms { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .bb-results-cols { grid-template-columns: 1fr; }
  .bb-podium { gap: 8px; }
  .bb-podium-name { font-size: 0.8rem; }
  .bb-row2, .bb-row3 { grid-template-columns: 1fr; }
  .bb-search input { width: 150px; }
}

/* touch devices: show touch help, hide desktop help line */
@media (pointer: coarse) {
  .bb-help-desktop { display: none; }
  .bb-help-touch { display: inline; }
}
/* desktop / fine pointer: hide the on-screen joystick + fly buttons (use keyboard) */
@media (pointer: fine) {
  .bb-joy, .bb-fly { display: none; }
}

/* short landscape (phone on its side): tighten the HUD */
@media (max-height: 480px) {
  .bb-build-head { top: 50px; }
  .bb-joy { width: 96px; height: 96px; bottom: 86px; }
  .bb-joy-knob { width: 42px; height: 42px; }
  .bb-fly-btn { width: 48px; height: 48px; }
  .bb-fly { bottom: 96px; }
  .bb-help { display: none; }
  .bb-toolbar { padding: 7px; }
  .bb-vote-num { width: 44px; height: 44px; font-size: 1.1rem; }
  /* compact waiting card so it fits a phone on its side */
  .bb-waiting { padding-top: 54px; }
  .bb-waiting-card { padding: 16px 22px; border-radius: 18px; }
  .bb-waiting-ic { font-size: 2rem; margin-bottom: 0; }
  .bb-waiting-card h2 { font-size: 1.2rem; margin: 0 0 4px; }
  .bb-waiting-card > p { font-size: 0.82rem; margin-bottom: 10px; }
  .bb-players { margin-bottom: 10px; gap: 7px; }
  .bb-config { margin-bottom: 10px; gap: 7px; }
}
