/* bug-maze.css - two-player Bug Maze duel. Uses the shared design tokens from
   app.css (:root). Player 1 = blue, Player 2 = purple. The maze board itself is
   dark for arcade contrast and big-screen booth readability. */

.bm-root {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.15rem 1rem 2.5rem;
  font-family: var(--fh);
  color: var(--text);
}

/* ---- HUD ---- */
.bm-hud {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
  align-items: stretch;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.7rem;
  background: #121725;
  border: 1px solid #293350;
  border-radius: 24px;
  box-shadow: 0 14px 35px rgba(24, 34, 67, 0.2);
}
.bm-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem 0.65rem;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid transparent;
  min-width: 0;
}
.bm-pill::after {
  content: '';
  position: absolute;
  width: 130px;
  height: 130px;
  right: -65px;
  bottom: -85px;
  border-radius: 50%;
  opacity: 0.28;
  filter: blur(4px);
}
.bm-pill.bm-p1 {
  background: linear-gradient(120deg, rgba(24, 95, 165, 0.27), rgba(22, 31, 52, 0.72));
  border-color: rgba(73, 157, 240, 0.48);
}
.bm-pill.bm-p2 {
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.27), rgba(29, 24, 54, 0.72));
  border-color: rgba(166, 106, 255, 0.48);
}
.bm-pill.bm-p1::after { background: #2584df; }
.bm-pill.bm-p2::after { background: #8d4dff; }
.bm-pill-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
}
.bm-runner-dot {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  color: #fff;
  font-family: var(--fb);
  font-size: 0.76rem;
  font-weight: 800;
  border-radius: 50%;
}
.bm-p1 .bm-runner-dot { background: #2584df; box-shadow: 0 0 14px rgba(37, 132, 223, 0.8); }
.bm-p2 .bm-runner-dot { background: #8d4dff; box-shadow: 0 0 14px rgba(141, 77, 255, 0.8); }
.bm-pill-tag {
  display: flex;
  min-width: 0;
  flex-direction: column;
  font-family: var(--fb);
  text-transform: uppercase;
}
.bm-pill-tag b {
  overflow: hidden;
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-pill-tag small {
  margin-top: 0.05rem;
  color: #a6b2d0;
  font-family: var(--fm);
  font-size: 0.56rem;
  letter-spacing: 0.05em;
}
.bm-score-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
}
.bm-pill-score {
  font-family: var(--fdisplay, var(--fb));
  font-size: 2.65rem;
  font-weight: 800;
  line-height: 0.9;
  color: #fff;
  text-shadow: 0 0 18px currentColor;
}
.bm-p1 .bm-pill-score { color: #75bdff; }
.bm-p2 .bm-pill-score { color: #bd91ff; }
.bm-score-target {
  color: #8893ae;
  font-family: var(--fm);
  font-size: 0.58rem;
  text-transform: uppercase;
}
.bm-score-track {
  position: relative;
  z-index: 1;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 99px;
}
.bm-score-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.3s ease;
}
.bm-p1 .bm-score-track span { background: #61b5ff; box-shadow: 0 0 9px #61b5ff; }
.bm-p2 .bm-score-track span { background: #ae7cff; box-shadow: 0 0 9px #ae7cff; }
.bm-score-pop { animation: bm-score-pop 0.35s ease; }
@keyframes bm-score-pop {
  50% { transform: scale(1.34) rotate(-4deg); filter: brightness(1.5); }
}
.bm-pill-wins {
  min-width: 2.5rem;
  min-height: 0.75rem;
  color: #ffc247;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: right;
  text-shadow: 0 0 8px rgba(255, 194, 71, 0.7);
}
.bm-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.4rem;
  color: #fff;
  background: linear-gradient(180deg, #1d2436, #141a29);
  border: 1px solid #343f5b;
  border-radius: 16px;
}
.bm-live-light {
  position: absolute;
  top: 0.42rem;
  right: 0.48rem;
  color: #7be7ad;
  font-family: var(--fm);
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bm-live-light::before {
  content: '';
  display: inline-block;
  width: 0.32rem;
  height: 0.32rem;
  margin-right: 0.22rem;
  background: #6fe3a0;
  border-radius: 50%;
  box-shadow: 0 0 8px #6fe3a0;
  animation: bm-pulse 1.2s ease-in-out infinite;
}
.bm-round-label {
  font-family: var(--fb);
  font-size: 0.66rem;
  color: #9aa6c4;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.bm-timer-shell {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0.08rem 0;
}
.bm-timer {
  font-family: var(--fm);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 18px rgba(117, 189, 255, 0.45);
}
.bm-timer-shell span { color: #6f7a98; font-size: 0.52rem; text-transform: uppercase; }
.bm-center > small { color: #6f7a98; font-size: 0.48rem; }
.bm-time-danger {
  border-color: rgba(255, 87, 105, 0.8);
  box-shadow: inset 0 0 22px rgba(255, 65, 85, 0.12), 0 0 18px rgba(255, 65, 85, 0.2);
  animation: bm-danger-throb 0.75s ease-in-out infinite;
}
.bm-time-danger .bm-timer { color: #ff6a7c; text-shadow: 0 0 18px rgba(255, 72, 94, 0.75); }
@keyframes bm-danger-throb { 50% { transform: scale(1.025); } }

.bm-screen-clear.on {
  background: radial-gradient(circle, rgba(15, 20, 34, 0.12), rgba(8, 11, 18, 0.62));
}
.bm-screen-clear .bm-count-num {
  position: relative;
  display: grid;
  width: 9rem;
  height: 9rem;
  place-items: center;
  color: #fff;
  font-size: 5.4rem;
  line-height: 1;
  background: radial-gradient(circle, rgba(42, 55, 91, 0.96) 0 52%, rgba(19, 25, 43, 0.9) 53%);
  border: 3px solid #7ebcff;
  border-radius: 50%;
  box-shadow:
    0 0 0 8px rgba(105, 174, 255, 0.12),
    0 0 42px rgba(77, 139, 255, 0.72),
    inset 0 0 28px rgba(107, 65, 255, 0.38);
}
.bm-screen-clear .bm-count-num::before {
  content: 'ROUND START';
  position: absolute;
  top: -2rem;
  padding: 0.3rem 0.6rem;
  color: #fff2ad;
  font-family: var(--fm);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: #1b2133;
  border: 1px solid rgba(255, 224, 111, 0.55);
  border-radius: 999px;
  box-shadow: 0 0 15px rgba(255, 204, 65, 0.24);
}
.bm-screen-clear .bm-count-num::after {
  content: '';
  position: absolute;
  inset: -15px;
  border: 2px dashed rgba(165, 130, 255, 0.7);
  border-radius: 50%;
  animation: bm-count-spin 3s linear infinite;
}
@keyframes bm-count-spin { to { transform: rotate(360deg); } }

/* ---- Stage + board ---- */
.bm-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 480px; /* keeps the start/result overlays visible before the board is built */
}
.bm-play-area {
  display: grid;
  grid-template-columns: auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.5rem;
}
.bm-mobile-hint,
.bm-controls { display: none; }
.bm-controls {
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: auto repeat(3, 44px);
  justify-content: center;
  gap: 3px;
  width: 138px;
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.bm-controls-label {
  grid-column: 1 / -1;
  margin-bottom: 0.2rem;
  font-family: var(--fm);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}
.bm-controls-p1 .bm-controls-label { color: #75bdff; }
.bm-controls-p2 .bm-controls-label { color: #bd91ff; }
.bm-dpad-btn,
.bm-dpad-center {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.bm-dpad-btn {
  padding: 0;
  color: #fff;
  font-family: var(--fb);
  font-size: 1.25rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22), 0 5px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.bm-controls-p1 .bm-dpad-btn { background: linear-gradient(145deg, #2b8be4, #185fa5); }
.bm-controls-p2 .bm-dpad-btn { background: linear-gradient(145deg, #985cff, #6730c8); }
.bm-dpad-center {
  color: #9da8c5;
  font-family: var(--fm);
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(18, 23, 37, 0.8);
  border: 1px solid #303b59;
}
.bm-dpad-up { grid-column: 2; grid-row: 2; }
.bm-dpad-left { grid-column: 1; grid-row: 3; }
.bm-dpad-center { grid-column: 2; grid-row: 3; }
.bm-dpad-right { grid-column: 3; grid-row: 3; }
.bm-dpad-down { grid-column: 2; grid-row: 4; }
.bm-dpad-pressed { transform: translateY(2px) scale(0.94); filter: brightness(1.25); }
.bm-board {
  position: relative;
  background: #14161f;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px #344365,
    0 0 0 7px rgba(28, 36, 58, 0.95),
    inset 0 0 34px rgba(76, 111, 255, 0.12),
    inset 0 0 70px rgba(0, 0, 0, 0.55),
    0 20px 50px rgba(20, 30, 62, 0.4);
  overflow: hidden;
  animation: bm-board-glow 4s ease-in-out infinite;
}
@keyframes bm-board-glow {
  50% {
    box-shadow:
      0 0 0 1px #46547a,
      0 0 0 7px rgba(28, 36, 58, 0.95),
      inset 0 0 42px rgba(124, 58, 237, 0.2),
      inset 0 0 70px rgba(0, 0, 0, 0.48),
      0 12px 46px rgba(35, 55, 130, 0.32);
  }
}

/* cells (positioned absolutely via inline left/top) */
.bm-wall,
.bm-bug,
.bm-power,
.bm-actor,
.bm-ghost {
  position: absolute;
  box-sizing: border-box;
}
.bm-wall {
  background: #283154;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(120, 150, 230, 0.18);
}
.bm-bug::before {
  content: '';
  position: absolute;
  inset: 36%;
  border-radius: 50%;
  background: #6fe3a0;
  box-shadow: 0 0 6px rgba(111, 227, 160, 0.55);
  animation: bm-coverage-pulse 1.6s ease-in-out infinite;
}
@keyframes bm-coverage-pulse {
  50% { transform: scale(1.28); box-shadow: 0 0 10px rgba(111, 227, 160, 0.88); }
}
.bm-power::before {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: transparent;
  border: 3px solid var(--amber);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.7);
  animation: bm-pulse 0.9s ease-in-out infinite;
}
@keyframes bm-pulse {
  0%, 100% { transform: scale(0.82); opacity: 0.75; }
  50%      { transform: scale(1.08); opacity: 1; }
}

/* players */
.bm-actor { top: 0; left: 0; z-index: 3; transition: opacity 0.15s linear; }
.bm-actor::before {
  content: '';
  position: absolute;
  inset: 13%;
  border-radius: 50%;
}
.bm-actor::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--fb);
  font-weight: 800;
  font-size: 0.7rem;
}
.bm-p1-actor::before { background: var(--blue); box-shadow: 0 0 12px rgba(24, 95, 165, 0.8); }
.bm-p2-actor::before { background: var(--purple); box-shadow: 0 0 12px rgba(124, 58, 237, 0.8); }
.bm-p1-actor::after { content: '1'; }
.bm-p2-actor::after { content: '2'; }
.bm-eat::before { animation: bm-eat 0.18s ease; }
@keyframes bm-eat {
  50% { transform: scale(1.22); }
}

/* bugs */
.bm-ghost {
  top: 0;
  left: 0;
  z-index: 2;
  color: var(--err);
  display: grid;
  place-items: center;
}
.bm-bug-sprite {
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px currentColor);
  animation: bm-bug-wobble 1.15s ease-in-out infinite;
  transform-origin: 50% 70%;
}
.bm-ghost:nth-of-type(3n) .bm-bug-sprite { animation-delay: -0.3s; }
.bm-ghost:nth-of-type(3n + 1) .bm-bug-sprite { animation-delay: -0.65s; }
.bm-bug-emoji {
  font-size: 1.7rem;
  line-height: 1;
  text-shadow: 0 0 8px currentColor;
  animation: bm-bug-wobble 1.15s ease-in-out infinite;
}
@keyframes bm-bug-wobble {
  0%, 100% { transform: translateY(1px) rotate(-4deg); }
  50% { transform: translateY(-2px) rotate(4deg); }
}
.bm-ghost-fright::after {
  content: '';
  position: absolute;
  inset: 10%;
  border: 2px solid #8eb4ff;
  border-radius: 50%;
  box-shadow: 0 0 10px #4f7bd6;
  animation: bm-fright-ring 0.65s ease-in-out infinite;
}
.bm-ghost-fright .bm-bug-sprite {
  filter: grayscale(1) drop-shadow(0 0 6px #8eb4ff);
  animation: bm-fright 0.5s steps(2) infinite;
}
.bm-ghost-fright .bm-bug-emoji { filter: grayscale(1); animation: bm-fright 0.5s steps(2) infinite; }
@keyframes bm-fright { 50% { opacity: 0.42; transform: scale(0.78); } }
@keyframes bm-fright-ring { 50% { inset: 2%; opacity: 0.35; } }

/* ---- Screens / overlays ---- */
.bm-screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 12, 18, 0.62);
  backdrop-filter: blur(2px);
}
.bm-screen.on { display: flex; }
.bm-screen-clear { background: transparent; backdrop-filter: none; }

.bm-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.4rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-height: 100%;
  overflow-y: auto;
}
.bm-card-slim { max-width: 360px; }

.bm-title {
  font-family: var(--fdisplay, var(--fb));
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bm-tagline { color: var(--muted); margin: 0.3rem 0 1rem; }

.bm-rules {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-align: left;
  margin-bottom: 1.2rem;
}
.bm-rule {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.9rem;
  color: var(--text);
}
.bm-key {
  flex: none;
  min-width: 74px;
  text-align: center;
  font-family: var(--fm);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  color: #fff;
}
.bm-key-p1 { background: var(--blue); }
.bm-key-p2 { background: var(--purple); }
.bm-chip {
  flex: none;
  width: 74px;
  text-align: center;
  font-weight: 800;
}
.bm-chip-bug { color: #2fa86a; }
.bm-chip-ghost { color: var(--err); }
.bm-chip-power { color: var(--amber); }
.bm-bug-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  width: 100%;
}
.bm-bug-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  font-size: 0.7rem;
  font-weight: 700;
}
.bm-bug-legend-icon {
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: inherit;
  filter: drop-shadow(0 0 4px currentColor);
}
.bm-bug-legend-icon img { width: 100%; height: 100%; object-fit: contain; }
.bm-bug-legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-bug-flaky { color: var(--err); }
.bm-bug-debt { color: var(--indigo); }
.bm-bug-deadline { color: var(--warn); }
.bm-bug-legend-caption {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 400;
}

/* buttons */
.bm-btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: var(--fb);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.bm-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.bm-btn-primary { background: linear-gradient(90deg, var(--blue), var(--purple)); color: #fff; }
.bm-btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.bm-link {
  display: inline-block;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.bm-link:hover { color: var(--text); }
.bm-byline { margin-top: 0.9rem; font-size: 0.72rem; color: var(--dim); }
.bm-byline a { color: var(--blue); text-decoration: none; }

/* countdown */
.bm-count-num {
  font-family: var(--fdisplay, var(--fb));
  font-size: 6rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
  animation: bm-count 0.7s ease;
}
@keyframes bm-count { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* results */
.bm-result-title {
  font-family: var(--fdisplay, var(--fb));
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
}
.bm-result-sub { font-family: var(--fm); color: var(--muted); margin: 0; }
.bm-insight { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 1rem; }
.bm-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* ---- two-player leaderboard ---- */
.bm-lb { text-align: left; }
.bm-lb-head {
  font-family: var(--fb);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.bm-lb-post {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}
.bm-lb-post.bm-p1 { border-left: 4px solid var(--blue); }
.bm-lb-post.bm-p2 { border-left: 4px solid var(--purple); }
.bm-lb-post.posted { opacity: 0.85; }
.bm-lb-badge {
  flex: none;
  font-family: var(--fb);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--muted);
  width: 1.4rem;
}
.bm-lb-name {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.5rem;
  font-family: var(--fh);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
}
.bm-lb-num {
  flex: none;
  font-family: var(--fm);
  font-weight: 700;
  color: var(--text);
  min-width: 1.8rem;
  text-align: right;
}
.bm-lb-btn {
  flex: none;
  border: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  color: #fff;
  font-family: var(--fb);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
}
.bm-lb-btn:disabled { opacity: 0.6; cursor: default; }
.bm-lb-posted { font-size: 0.88rem; color: var(--ok); font-weight: 600; }
.bm-lb-list { margin: 0.6rem 0 0; padding: 0; list-style: none; }

/* Reuse the shared leaderboard row look (tt-lb-* defined in tt-leaderboard.css);
   provide a fallback in case that sheet hasn't loaded. */
.bm-lb-list .tt-lb-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.bm-lb-list .tt-lb-rank { flex: none; width: 1.8rem; }
.bm-lb-list .tt-lb-player { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-lb-list .tt-lb-score { flex: none; font-family: var(--fm); font-weight: 700; }
.bm-lb-list .tt-lb-loading,
.bm-lb-list .tt-lb-empty { color: var(--muted); font-size: 0.85rem; padding: 0.3rem 0.2rem; }

@media (max-width: 520px) {
  .bm-pill-score { font-size: 1.5rem; }
  .bm-timer { font-size: 1.7rem; }
  .bm-center { min-width: 80px; }
  .bm-bug-legend-item { flex-direction: column; text-align: center; }
  .bm-bug-legend-name { white-space: normal; }
}

/* ---- Start screen: compact match briefing ---- */
.bm-stage:has(#bm-start.on) { min-height: 570px; }

#bm-start {
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(24, 95, 165, 0.32), transparent 34%),
    radial-gradient(circle at 84% 84%, rgba(124, 58, 237, 0.32), transparent 38%),
    #111521;
  border-radius: var(--radius-lg);
}
#bm-start::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.17;
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
}

.bm-intro-card {
  position: relative;
  z-index: 1;
  max-width: 760px;
  max-height: none;
  padding: 1.2rem;
  overflow: visible;
  color: #f6f7ff;
  text-align: left;
  background: rgba(19, 23, 37, 0.95);
  border: 1px solid rgba(154, 169, 225, 0.22);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}
.bm-intro-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.15rem 0.2rem 1rem;
  border-bottom: 1px solid rgba(154, 169, 225, 0.15);
}
.bm-logo-mark {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(145deg, #2378d0, #783df0);
  box-shadow: 0 0 28px rgba(83, 89, 243, 0.42);
}
.bm-logo-mark::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 5px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
}
.bm-logo-mark::after {
  content: '';
  position: absolute;
  right: 7px;
  top: 22px;
  width: 19px;
  height: 10px;
  background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.bm-kicker,
.bm-section-label {
  margin: 0;
  color: #8da8ff;
  font-family: var(--fb);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.bm-intro-card .bm-title {
  width: fit-content;
  margin: -0.06rem 0 0;
  color: #fff;
  font-size: clamp(2.25rem, 6vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  background: none;
  -webkit-text-fill-color: currentColor;
}
.bm-intro-card .bm-title span { color: #71a9ff; }
.bm-intro-card .bm-tagline {
  margin: 0.28rem 0 0;
  color: #adb6d3;
  font-size: 0.82rem;
}
.bm-match-badge {
  align-self: start;
  padding: 0.34rem 0.58rem;
  color: #d4c5ff;
  font-family: var(--fm);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid rgba(171, 126, 255, 0.35);
  border-radius: 999px;
}
.bm-intro-grid {
  display: grid;
  grid-template-columns: 1.03fr 0.97fr;
  gap: 0.8rem;
  margin-top: 0.8rem;
}
.bm-players,
.bm-threat-panel {
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(154, 169, 225, 0.13);
  border-radius: 16px;
}
.bm-player-cards {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.bm-player-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.56rem;
  border-radius: 12px;
}
.bm-player-one {
  background: linear-gradient(90deg, rgba(35, 120, 208, 0.22), rgba(35, 120, 208, 0.05));
  border: 1px solid rgba(72, 154, 237, 0.36);
}
.bm-player-two {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), rgba(124, 58, 237, 0.05));
  border: 1px solid rgba(160, 104, 255, 0.36);
}
.bm-player-orb {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  color: #fff;
  font-family: var(--fb);
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 50%;
}
.bm-player-one .bm-player-orb { background: #2378d0; box-shadow: 0 0 14px rgba(35, 120, 208, 0.65); }
.bm-player-two .bm-player-orb { background: #7c3aed; box-shadow: 0 0 14px rgba(124, 58, 237, 0.65); }
.bm-player-copy { display: flex; min-width: 0; flex-direction: column; }
.bm-player-copy b { font-size: 0.8rem; line-height: 1.1; }
.bm-player-copy small { color: #8993b0; font-size: 0.63rem; }
.bm-intro-card .bm-key {
  min-width: 78px;
  color: #dce8ff;
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  background: rgba(8, 11, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
.bm-objective,
.bm-focus-callout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.58rem;
  margin-top: 0.55rem;
  padding: 0.58rem 0.65rem;
  border-radius: 12px;
}
.bm-objective {
  color: #d8f8e6;
  background: rgba(47, 168, 106, 0.1);
  border: 1px solid rgba(91, 218, 151, 0.24);
}
.bm-objective > span:nth-child(2),
.bm-focus-callout > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.bm-objective b,
.bm-focus-callout b { font-size: 0.75rem; line-height: 1.15; }
.bm-objective small,
.bm-focus-callout small { margin-top: 0.1rem; color: #91a0ba; font-size: 0.61rem; }
.bm-objective strong { color: #75e4aa; font-family: var(--fm); font-size: 1.35rem; }
.bm-coverage-dot {
  width: 0.62rem;
  height: 0.62rem;
  background: #6fe3a0;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(111, 227, 160, 0.8);
}
.bm-threat-heading { display: flex; justify-content: space-between; gap: 0.5rem; }
.bm-threat-heading p:last-child { margin: 0.18rem 0 0; color: #98a1bb; font-size: 0.66rem; }
.bm-alert-dot {
  width: 0.48rem;
  height: 0.48rem;
  margin: 0.16rem;
  background: #ff6375;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff6375;
  animation: bm-pulse 1.2s ease-in-out infinite;
}
.bm-threat-panel .bm-bug-legend { gap: 0.38rem; margin-top: 0.6rem; }
.bm-threat-panel .bm-bug-legend-item {
  flex-direction: column;
  gap: 0.16rem;
  padding: 0.42rem 0.18rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
}
.bm-threat-panel .bm-bug-legend-icon { width: 2rem; height: 2rem; }
.bm-threat-panel .bm-bug-legend-name { width: 100%; font-size: 0.58rem; }
.bm-focus-callout {
  color: #ffe7aa;
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.18), rgba(255, 194, 71, 0.06));
  border: 1px solid rgba(255, 194, 71, 0.35);
}
.bm-focus-icon {
  position: relative;
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid #ffc247;
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(255, 194, 71, 0.55);
}
.bm-focus-icon::before,
.bm-focus-icon::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 226, 160, 0.8);
  border-radius: 50%;
}
.bm-focus-icon::after { inset: 10px; background: #ffc247; border: 0; }
.bm-focus-tag { color: #ffc247; font-family: var(--fm); font-size: 0.52rem; font-weight: 800; letter-spacing: 0.08em; }
.bm-intro-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
}
.bm-intro-footer .bm-link,
.bm-intro-footer .bm-byline { margin: 0; color: #7f89a5; font-size: 0.62rem; }
.bm-intro-footer .bm-byline { text-align: right; }
.bm-intro-footer .bm-btn-primary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.7rem 0.62rem 1rem;
  color: #fff;
  text-transform: uppercase;
  background: linear-gradient(100deg, #2378d0, #743cf0);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(64, 69, 224, 0.28);
}
.bm-intro-footer .bm-btn-primary span { font-size: 0.75rem; letter-spacing: 0.05em; }
.bm-intro-footer .bm-btn-primary b { padding: 0.32rem 0.5rem; font-size: 0.58rem; background: rgba(255, 255, 255, 0.16); border-radius: 999px; }

@media (max-width: 720px) {
  .bm-root { padding-top: 0.65rem; }
  .bm-hud {
    grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
    gap: 0.42rem;
    padding: 0.45rem;
    border-radius: 16px;
  }
  .bm-pill { gap: 0.3rem; padding: 0.5rem; border-radius: 12px; }
  .bm-pill-head { grid-template-columns: auto 1fr; gap: 0.35rem; }
  .bm-runner-dot { width: 1.4rem; height: 1.4rem; font-size: 0.64rem; }
  .bm-pill-tag b { font-size: 0.54rem; }
  .bm-pill-tag small { font-size: 0.48rem; }
  .bm-pill-wins { grid-column: 1 / -1; min-height: 0.55rem; text-align: left; font-size: 0.58rem; }
  .bm-pill-score { font-size: 1.8rem; }
  .bm-score-target { display: none; }
  .bm-center { padding: 0.3rem; border-radius: 12px; }
  .bm-live-light,
  .bm-center > small,
  .bm-timer-shell span { display: none; }
  .bm-round-label { font-size: 0.5rem; letter-spacing: 0.08em; }
  .bm-timer { font-size: 1.8rem; }
  .bm-stage:has(#bm-start.on) { min-height: 820px; }
  .bm-intro-card { max-width: 440px; padding: 0.9rem; border-radius: 18px; }
  .bm-intro-grid { grid-template-columns: 1fr; }
  .bm-intro-footer { grid-template-columns: 1fr; justify-items: center; }
  .bm-intro-footer .bm-btn-primary { grid-row: 1; }
  .bm-intro-footer .bm-byline { display: none; }
  .bm-logo-mark { width: 46px; height: 46px; border-radius: 13px; }
  .bm-logo-mark::before { inset: 8px; }
  .bm-logo-mark::after { right: 5px; top: 19px; }
}

@media (hover: none), (pointer: coarse) {
  .bm-root.bm-game-active .bm-controls { display: grid; }
  .bm-root.bm-game-active .bm-play-area {
    grid-template-columns: 138px auto 138px;
    gap: 0.5rem;
  }
  .bm-root.bm-game-active .bm-stage {
    min-height: 0;
    justify-content: flex-start;
  }
}

@media (hover: none) and (orientation: portrait), (pointer: coarse) and (orientation: portrait) {
  .bm-root.bm-game-active .bm-mobile-hint {
    display: block;
    align-self: center;
    margin: 0 0 0.55rem;
    padding: 0.3rem 0.55rem;
    color: #7a668f;
    font-family: var(--fm);
    font-size: 0.58rem;
    text-align: center;
    background: #f3eefb;
    border: 1px solid #dfd4f1;
    border-radius: 999px;
  }
  .bm-root.bm-game-active .bm-play-area {
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    gap: 1.2rem 0.8rem;
    justify-content: center;
    align-items: start;
  }
  .bm-root.bm-game-active .bm-board {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .bm-root.bm-game-active .bm-controls-p1 {
    grid-column: 1;
    grid-row: 2;
  }
  .bm-root.bm-game-active .bm-controls-p2 {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 400px) {
  .bm-root { padding-inline: 0.5rem; }
  .bm-hud { grid-template-columns: 1fr 68px 1fr; gap: 0.25rem; padding: 0.3rem; }
  .bm-pill { padding: 0.4rem; }
  .bm-pill-tag b { display: none; }
  .bm-pill-tag small { font-size: 0.45rem; }
  .bm-pill-score { font-size: 1.55rem; }
  .bm-center { min-width: 0; }
  .bm-timer { font-size: 1.55rem; }
  .bm-stage:has(#bm-start.on) { min-height: 810px; }
  .bm-intro-hero { grid-template-columns: auto 1fr; }
  .bm-match-badge { display: none; }
  .bm-intro-card .bm-title { font-size: 2.2rem; }
  .bm-player-card { grid-template-columns: auto 1fr; }
  .bm-player-card .bm-key { grid-column: 1 / -1; width: 100%; }
  .bm-intro-card { padding: 0.72rem; }
  .bm-players,
  .bm-threat-panel { padding: 0.68rem; }
}
