.bbHubPage {
  min-height: 100vh;
  height: auto;
  margin: 0;
  padding: clamp(16px, 3vw, 28px);
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI", Inter, Roboto, Arial, sans-serif;
  box-sizing: border-box;
}

html {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.bbTopbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 14px;
  max-width: 1180px;
  width: 100%;
  box-sizing: border-box;
}

.bbHomeLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(5px);
  color: var(--ink);
  text-decoration: none;
}

.bbHomeLink:hover {
  background: rgba(35, 62, 109, 0.42);
}

.bbChevron {
  opacity: 0.92;
}

.bbPlaqueWrap {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 120px;
}

.bbPlaqueSvg {
  display: block;
  width: min(360px, 58vw);
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.bbIconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(5px);
  color: var(--ink);
  cursor: pointer;
}

.bbIconBtn:hover {
  background: rgba(35, 62, 109, 0.42);
}

.bbMain {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.bbPane {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(6px);
  padding: 14px 14px 16px;
  min-width: 0;
}

.bbPaneHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.bbPane2HeadCluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.bbPane2BugWrap {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bbPane2BugSvg {
  width: 100%;
  height: 100%;
  display: block;
}

.bbPane2HeadTexts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.bbPane2SubTitle {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.25;
}

.bbPaneTitle {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.bbPaneMeta {
  color: var(--muted);
  font-size: 12px;
}

.bbActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.bbActionsBottom {
  margin-top: 14px;
  margin-bottom: 0;
}

.bbCard {
  border: 1px solid rgba(129, 156, 206, 0.16);
  background: rgba(19, 32, 64, 0.22);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.bbCardTitle {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bbBtn {
  display: inline-block;
  border: 1px solid rgba(132, 165, 219, 0.35);
  background: rgba(35, 62, 109, 0.45);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

/* Hub menu: rules entry — slightly larger + emoji (see #bbRulesBtn). */
.bbRulesHubBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 9px 14px;
  font-size: clamp(0.8125rem, 2.1vw, 0.9375rem);
  font-weight: 650;
  line-height: 1.2;
}

.bbRulesHubBtn__icon {
  font-size: 1.1em;
  line-height: 1;
}

.bbBtn:hover {
  background: rgba(45, 78, 128, 0.55);
}

.bbBtn:disabled,
.bbBtn.isDisabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.bbBtnPrimary {
  border-color: rgba(232, 168, 32, 0.45);
  background: rgba(232, 168, 32, 0.18);
}

.bbBtnPrimary:hover {
  background: rgba(232, 168, 32, 0.24);
}

.bbBtnGhost {
  background: transparent;
}

.bbBtnGhost:hover {
  background: rgba(35, 62, 109, 0.34);
}

.bbUserUiSection {
  margin-bottom: 8px;
}

.bbUserUiSubTitle {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bbUserUiBlurb {
  margin: 0 0 12px;
  line-height: 1.45;
}

.bbUserUiGrid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.bbUserUiPaletteField.bbHidden {
  display: none;
}

.bbUserUiLabel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.bbSelect {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(132, 165, 219, 0.35);
  background-color: #1a2d4d;
  background-image: linear-gradient(180deg, rgba(45, 78, 128, 0.45), rgba(26, 45, 77, 0.95));
  color: #e8f0ff;
  font-size: 13px;
  font-family: inherit;
  /* Native list follows dark UI (avoids light popup + light text on Windows/Chromium). */
  color-scheme: dark;
}

.bbSelect option,
.bbSelect optgroup {
  background-color: #152238;
  color: #e8f0ff;
}

.bbSelect option:checked,
.bbSelect option:hover {
  background-color: #2a4d82;
  color: #ffffff;
}

.bbSelect:focus-visible {
  outline: 2px solid rgba(132, 165, 219, 0.55);
  outline-offset: 1px;
}

.bbDraftInviteLinkWrap {
  margin: 0 0 10px;
}

.bbDraftInviteLink {
  display: inline;
  color: #b8d4ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
  font-size: 13px;
  line-height: 1.45;
  user-select: text;
  cursor: pointer;
}

.bbDraftInviteLink:hover {
  color: #dbeaff;
}

.bbUserColorPreviewWrap {
  border-radius: 12px;
  border: 1px solid rgba(132, 165, 219, 0.28);
  background: #f4f6fa;
  padding: 10px 12px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.bbUserColorPreviewSvg {
  display: block;
  width: 100%;
  min-width: 280px;
  height: 72px;
  max-height: 22vw;
}

.bbDivider {
  border: none;
  border-top: 1px solid rgba(132, 165, 219, 0.22);
  margin: 16px 0;
}

.bbRoomRow {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(129, 156, 206, 0.22);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(19, 32, 64, 0.18);
}

.bbRoomRowMeta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.bbRoomBadges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bbRoomBadge {
  border: 1px solid rgba(132, 165, 219, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--muted);
}

.bbRoomBadgeMe {
  border-color: rgba(232, 168, 32, 0.45);
  color: var(--ink);
}

.bbRoomSelectedPreview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bbRoomColorSwatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(132, 165, 219, 0.45);
  display: inline-block;
}

.bbRoomList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.bbRoomList li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(129, 156, 206, 0.15);
  margin: 0;
}

.bbRoomList li:last-child {
  border-bottom: none;
}

.bbRoomList li.bbRoomListItem--selected {
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 10px;
  border-bottom: none;
  background: rgba(35, 62, 109, 0.42);
  box-shadow:
    0 0 0 1px rgba(232, 168, 32, 0.38),
    0 0 18px rgba(232, 168, 32, 0.12);
}

.bbRoomList li.bbRoomListItem--selected .bbRoomTitle {
  color: #f0f6ff;
}

.bbRoomListActions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.bbRoomSelectBtn,
.bbRoomSettingsBtn,
.bbRoomOpenBtn {
  flex-shrink: 0;
}

.bbRoomSelectedMark {
  margin-inline-end: 2px;
}

.bbRoomTitle {
  font-weight: 600;
}

.bbMuted {
  color: var(--muted);
  font-size: 12px;
}

.bbPager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.bbPagerLabel {
  color: var(--muted);
  font-size: 12px;
  min-width: 96px;
  text-align: center;
}

.bbListMeta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.bbPaneBody {
  min-height: 120px;
}

.bbHidden {
  display: none !important;
}

.bbError {
  color: var(--bad);
  font-size: 12px;
}

/* Guest landing: game pitch + Rules before sign-in banner. */
.bbGuestIntro {
  max-width: 1180px;
  margin: 0 auto 18px;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(1rem, 2.5vw, 1.35rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(6px);
}

.bbGuestIntro__text {
  margin: 0 0 1rem;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.5;
  color: var(--muted);
}

.bbGuestIntro__text strong {
  color: var(--ink);
  font-weight: 650;
}

.bbGuestIntro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Hub-wide messages (sign-in, hub load errors): centered, readable. */
.bbHubBanner {
  max-width: 1180px;
  margin: 0 auto 18px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: clamp(1rem, 3vw, 1.35rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.35);
  backdrop-filter: blur(6px);
  color: #fecaca;
}

.bbHubBanner__msg {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  line-height: 1.45;
  font-weight: 600;
  color: #fee2e2;
}

.bbHubBanner__foot {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bbGuestAccountHint__lead {
  margin: 0 0 8px;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  font-weight: 650;
  color: var(--ink);
}

.bbOverlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.72);
  backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: clamp(10px, 2vw, 20px) clamp(8px, 1.4vw, 16px);
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
}

.bbOverlayTop {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(6px);
}

.bbOverlayTop .bbPlaqueWrap {
  flex: 1;
  min-width: 0;
}

.bbOverlayTitle {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.bbOverlayBody {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  align-self: stretch;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(19, 32, 64, 0.22);
  padding: clamp(14px, 2.2vw, 22px) clamp(12px, 2vw, 20px);
  overflow: visible;
}

.bbRulesBlock {
  max-width: min(72rem, 100%);
  margin: 0 auto;
}

/* Rules overlay: use full panel width — no narrow centered column with empty side margins */
.bbOverlay .bbRulesBlock {
  max-width: 100%;
  width: 100%;
  margin-inline: 0;
}

.bbRulesLayout {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.bbRulesChapter {
  min-width: 0;
}

.bbRulesChapter--introSplit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.46fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: start;
}

.bbRulesChapter--fightersSplit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.46fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: stretch;
}

.bbRulesColFightersText {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  min-width: 0;
}

.bbRulesChapter--fightersSplit > .bbRulesColAnim2 {
  justify-content: center;
}

.bbRulesColAnim2 {
  /* Chapter2 board + HUD width cap (same pattern as Chapter1) */
  --bbChapter2AnimMaxW: min(86.4vmin, 432px);
}

.bbRulesChapter2AnimHud,
.bbRulesChapter2AnimMount {
  width: min(100%, var(--bbChapter2AnimMaxW));
  margin-inline: auto;
  box-sizing: border-box;
}

.bbRulesChapter2AnimHud {
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  line-height: 1.3;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #f0f6ff;
  text-align: center;
  padding: 0.55em 0.75em;
  border-radius: 10px;
  border: 1px solid rgba(232, 168, 32, 0.45);
  background: linear-gradient(180deg, rgba(32, 48, 88, 0.95) 0%, rgba(14, 22, 44, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 4px 14px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.bbRulesChapter2AnimMount {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f4f6fa;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.bbRulesChapter2AnimStage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.bbRulesChapter2Banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  max-width: 88%;
  padding: 0.55em 1em;
  border-radius: 10px;
  border: 1px solid rgba(232, 168, 32, 0.55);
  background: linear-gradient(180deg, rgba(32, 48, 88, 0.98) 0%, rgba(14, 22, 44, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 6px 20px rgba(0, 0, 0, 0.45);
  color: #f7fbff;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.bbRulesChapter2Banner.bbHidden {
  display: none;
}

.bbRulesChapter2Corner {
  position: absolute;
  right: clamp(0.35rem, 1.2vw, 0.65rem);
  bottom: clamp(0.35rem, 1.2vw, 0.65rem);
  z-index: 4;
  max-width: 72%;
  padding: 0.35em 0.55em;
  border-radius: 8px;
  border: 1px solid rgba(90, 120, 180, 0.55);
  background: rgba(12, 18, 36, 0.88);
  color: #e8f0ff;
  font-size: clamp(0.78rem, 1.85vw, 1.05rem);
  font-weight: 750;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.bbRulesChapter2Corner.bbHidden {
  display: none;
}

.bbRulesChapter2AnimSvgWrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.bbRulesChapter2AnimSvg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@keyframes bbRulesCellFlashPulse {
  0%,
  100% {
    fill: rgba(80, 200, 90, 0.22);
  }
  50% {
    fill: rgba(80, 220, 100, 0.62);
  }
}

.bbRulesChapterAnimSvg .bbRulesCellFlash,
.bbRulesChapter2AnimSvg .bbRulesCellFlash {
  animation: bbRulesCellFlashPulse 0.72s ease-in-out infinite;
  pointer-events: none;
}

@media (max-width: 900px) {
  .bbRulesChapter--fightersSplit {
    grid-template-columns: 1fr;
  }

  .bbRulesColAnim2 {
    padding-inline-start: 0;
    border-inline-start: none;
    padding-block-start: clamp(0.5rem, 2vw, 1rem);
    border-block-start: 1px solid rgba(135, 170, 235, 0.22);
    --bbChapter2AnimMaxW: min(105.6vmin, 480px);
  }
}

.bbRulesColAnim {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding-inline-start: clamp(0.75rem, 2.5vw, 2rem);
  border-inline-start: 1px solid rgba(135, 170, 235, 0.22);
  /* Same cap for HUD bar and board so widths match */
  --bbChapterAnimMaxW: min(86.4vmin, 432px);
}

.bbRulesChapterAnimHud,
.bbRulesChapterAnimMount {
  width: min(100%, var(--bbChapterAnimMaxW));
  margin-inline: auto;
  box-sizing: border-box;
}

.bbRulesChapterAnimHud {
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  line-height: 1.3;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #f0f6ff;
  text-align: center;
  padding: 0.55em 0.75em;
  border-radius: 10px;
  border: 1px solid rgba(232, 168, 32, 0.45);
  background: linear-gradient(180deg, rgba(32, 48, 88, 0.95) 0%, rgba(14, 22, 44, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 4px 14px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.bbRulesChapterAnimMount {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f4f6fa;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bbRulesChapterAnimSvgWrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.bbRulesChapterAnimSvg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 900px) {
  .bbRulesChapter--introSplit {
    grid-template-columns: 1fr;
  }

  .bbRulesColAnim {
    padding-inline-start: 0;
    border-inline-start: none;
    padding-block-start: clamp(0.5rem, 2vw, 1rem);
    border-block-start: 1px solid rgba(135, 170, 235, 0.22);
    --bbChapterAnimMaxW: min(105.6vmin, 480px);
  }
}

.bbRulesToy {
  margin-top: clamp(0.25rem, 1.5vw, 0.75rem);
  padding-top: clamp(1rem, 2.5vw, 1.75rem);
  border-top: 1px solid var(--panel-border);
}

.bbRulesToyHint {
  margin: 0 0 0.65rem;
  font-size: clamp(0.9rem, 1.8vw, 1rem);
  line-height: 1.42;
  max-width: 42rem;
}

.bbRulesToyMount {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: min(92vmin, 560px);
  margin-inline: auto;
}

.bbRulesToyToolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
}

.bbRulesToyBtn {
  font-size: clamp(0.75rem, 1.5vw, 0.875rem);
  padding: 0.35rem 0.65rem;
}

.bbRulesToyCoords {
  font-size: clamp(0.8rem, 1.55vw, 0.9rem);
  min-width: min(100%, 14rem);
  flex: 1 1 auto;
}

.bbRulesToySvgWrap {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #f4f6fa;
}

.bbRulesToySvg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.bbRulesToySvg.isPanning {
  cursor: grabbing;
}

.bbRulesDocRest {
  margin-top: 0;
}

/* Wood plaque frame (practice invite + chapter anim tips). */
.bbRulesPracticeCallout,
.bbRulesChapterAnimTip,
.bbRulesChapter2AnimTip {
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(232, 180, 90, 0.42);
  background: linear-gradient(
    168deg,
    rgba(46, 28, 18, 0.96) 0%,
    rgba(32, 20, 14, 0.98) 42%,
    rgba(22, 14, 10, 0.99) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 5px 20px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(255, 200, 100, 0.08);
  position: relative;
  overflow: hidden;
}

.bbRulesPracticeCallout::before,
.bbRulesChapterAnimTip::before,
.bbRulesChapter2AnimTip::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 11px,
    rgba(0, 0, 0, 0.14) 11px,
    rgba(0, 0, 0, 0.14) 12px
  );
  pointer-events: none;
  opacity: 0.5;
}

.bbRulesPracticeCallout__body {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.bbRulesPracticeCallout__text,
.bbRulesChapterAnimTip__text,
.bbRulesChapter2AnimTip__text {
  margin: 0;
  font-size: clamp(1.02rem, 2.15vw, 1.28rem);
  line-height: 1.48;
  color: #f3efe6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.bbRulesPracticeCallout__text strong,
.bbRulesChapterAnimTip__text strong,
.bbRulesChapter2AnimTip__text strong {
  color: #ffe9a8;
  font-weight: 750;
}

/* Practice-board invite: mascots + wide plaque in doc column. */
.bbRulesPracticeCallout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.65rem, 2.2vw, 1.25rem);
  margin: 1.25em auto 0.35em;
  padding: clamp(0.75rem, 2vw, 1.05rem) clamp(0.85rem, 2.4vw, 1.35rem);
  max-width: min(100%, 52rem);
}

/* Tip under chapter-1 animation (same width as board column). */
.bbRulesChapterAnimTip {
  display: block;
  width: min(100%, var(--bbChapterAnimMaxW, min(86.4vmin, 432px)));
  max-width: none;
  margin-inline: auto;
  margin-top: clamp(0.5rem, 1.5vw, 0.85rem);
  padding: clamp(0.65rem, 1.8vw, 0.95rem) clamp(0.75rem, 2vw, 1.1rem);
}

.bbRulesChapterAnimTip__text {
  position: relative;
  z-index: 1;
}

/* Tip under chapter-2 animation (same width as board column). */
.bbRulesChapter2AnimTip {
  display: block;
  width: min(100%, var(--bbChapter2AnimMaxW, min(86.4vmin, 432px)));
  max-width: none;
  margin-inline: auto;
  margin-top: clamp(0.5rem, 1.5vw, 0.85rem);
  padding: clamp(0.65rem, 1.8vw, 0.95rem) clamp(0.75rem, 2vw, 1.1rem);
}

.bbRulesChapter2AnimTip__text {
  position: relative;
  z-index: 1;
}

.bbRulesPracticeCallout__mascot {
  flex-shrink: 0;
  width: clamp(48px, 11vw, 72px);
  height: clamp(48px, 11vw, 72px);
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55));
}

.bbRulesDoc .bbRulesPracticeCallout__text {
  margin: 0;
}

@media (max-width: 420px) {
  .bbRulesPracticeCallout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    justify-items: center;
    text-align: center;
    column-gap: 1rem;
    row-gap: 0.5rem;
  }

  .bbRulesPracticeCallout__mascot--green {
    grid-column: 1;
    grid-row: 1;
  }

  .bbRulesPracticeCallout__mascot--red {
    grid-column: 2;
    grid-row: 1;
  }

  .bbRulesPracticeCallout__body {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
}

/* Practice arena under rules (empty board shell; not gated on toy preview user). */
.bbRulesPracticeArena {
  margin-top: clamp(1rem, 2.5vw, 1.75rem);
  padding-top: clamp(1rem, 2.5vw, 1.75rem);
  border-top: 1px solid var(--panel-border);
  width: 100%;
  max-width: min(72rem, 100%);
  margin-inline: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: clamp(0.65rem, 1.8vw, 1rem);
  min-width: 0;
}

.bbRulesPracticeTurnBar {
  --bbPracticeMaxW: min(96vmin, 720px);
  width: min(100%, var(--bbPracticeMaxW));
  margin-inline: auto;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 4px 14px rgba(0, 0, 0, 0.28);
}

.bbRulesPracticeTurnBarInner {
  display: grid;
  gap: 0.45rem 0.75rem;
  padding: clamp(0.55rem, 1.6vw, 0.85rem) clamp(0.65rem, 2vw, 1rem);
  align-items: center;
}

@media (min-width: 560px) {
  .bbRulesPracticeTurnBarInner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
}

.bbRulesPracticeTurnTitle {
  font-family: "Luckiest Guy", system-ui, sans-serif;
  font-size: clamp(1.15rem, 3.2vw, 1.65rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #0f1a0f;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

.bbRulesPracticeTurnMeta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  font-size: clamp(0.95rem, 2.1vw, 1.2rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color: #0f1a0f;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.32);
}

.bbRulesPracticeTurnSep {
  opacity: 0.55;
}

.bbRulesPracticeTurnActions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  justify-content: flex-end;
}

.bbRulesPracticeBtn {
  font-size: clamp(0.78rem, 1.65vw, 0.9rem);
  padding: 0.35rem 0.6rem;
}

.bbRulesPracticeBoardMount {
  --bbPracticeMaxW: min(96vmin, 720px);
  width: min(100%, var(--bbPracticeMaxW));
  margin-inline: auto;
  box-sizing: border-box;
  aspect-ratio: 20 / 14;
  max-height: min(72vh, 520px);
  overflow: hidden;
  background: #f4f6fa;
  border-radius: 10px;
  border: 1px solid rgba(120, 140, 180, 0.35);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bbRulesPracticeSvgWrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.bbRulesPracticeSvg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.bbRulesPracticeSvg.isPanning {
  cursor: grabbing;
}

.bbRulesPracticeHudRow {
  --bbPracticeMaxW: min(96vmin, 720px);
  width: min(100%, var(--bbPracticeMaxW));
  margin-inline: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(0.5rem, 2vw, 1rem);
  padding: 0.35rem 0.15rem 0.15rem;
  min-width: 0;
}

.bbRulesPracticeReloadBtn {
  flex-shrink: 0;
  margin-top: 0.1em;
}

.bbRulesPracticeCellPanel {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  display: grid;
  gap: 4px;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}

.bbRulesPracticeCellPanel .cellStatusDetail {
  display: grid;
  gap: 4px;
  font-size: 11px;
  line-height: 1.35;
}

.bbRulesPracticeCellPanel .cellStatusLine1 {
  line-height: 1.35;
}

.bbRulesPracticeCellPanel .cellStatusMovesLine {
  color: var(--muted);
}

.bbRulesPracticeCellPanel .cellStatusAttackLine {
  display: block;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--ink);
  width: fit-content;
  max-width: 100%;
}

.bbRulesPracticeCellPanel .cellStatusAttackLine.is-true {
  background: rgba(34, 170, 88, 0.62);
}

.bbRulesPracticeCellPanel .cellStatusAttackLine.is-false {
  background: rgba(210, 58, 58, 0.62);
}

.bbRulesPracticeCellPanel .cellStatusAttackLine.is-unknown {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.bbRulesPracticeCellErrorLine {
  font-size: 11px;
  line-height: 1.35;
  color: #fecaca;
}

.bbRulesDoc {
  color: var(--ink);
  font-size: clamp(1.125rem, 2.4vw, 1.5rem);
  line-height: 1.52;
}

.bbRulesDoc .bbMuted {
  font-size: inherit;
  line-height: inherit;
}

.bbRulesDoc h2 {
  font-size: clamp(1.35rem, 3.1vw, 1.95rem);
  font-weight: 650;
  margin: 1.35em 0 0.45em;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.bbRulesDocRest h2:first-of-type {
  margin-top: 0.15em;
}

.bbRulesDoc h2:first-of-type {
  margin-top: 0.35em;
}

.bbRulesDoc p {
  margin: 0.55em 0;
}

.bbRulesDoc ul {
  margin: 0.4em 0 0.55em 1.25em;
  padding: 0;
}

.bbRulesDoc li {
  margin: 0.35em 0;
}

.bbRulesLead {
  margin-top: 0;
}

.bbToast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  border: 1px solid rgba(232, 168, 32, 0.35);
  background: rgba(19, 32, 64, 0.74);
  backdrop-filter: blur(6px);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  max-width: min(520px, calc(100vw - 24px));
}

@media (orientation: landscape) and (min-width: 1200px) {
  .bbMain {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .bbPane {
    min-height: 520px;
  }
}
