:root {
  --bb-bg-1: #fff7ef;
  --bb-bg-2: #fff1d8;
  --bb-card: #ffffff;
  --bb-card-border: #f0d7a8;
  --bb-text: #3c2a16;
  --bb-soft: #7b6548;
  --bb-primary: #ff9f1c;
  --bb-primary-2: #ffbf69;
  --bb-accent: #7c3aed;
  --bb-success: #2da44e;
  --bb-danger: #c62828;
  --bb-warning: #ef6c00;
  --bb-shadow: 0 12px 30px rgba(76, 43, 10, 0.12);
  --bb-radius-xl: 28px;
  --bb-radius-lg: 20px;
  --bb-radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--bb-text);
  background:
    radial-gradient(circle at top left, rgba(255, 191, 105, 0.45), transparent 28%),
    radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 25%),
    linear-gradient(180deg, var(--bb-bg-1), var(--bb-bg-2));
}

.bbHiddenHeader {
  display: none;
}

.bbPage {
  min-height: 100vh;
}

.bbShell {
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.bbHero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(240, 215, 168, 0.9);
  border-radius: var(--bb-radius-xl);
  box-shadow: var(--bb-shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}

.bbEyebrow {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bb-accent);
  margin-bottom: 8px;
}

#bbEventTitle {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 2vw, 2.5rem);
  line-height: 1.08;
}

#bbEventSubtitle {
  margin: 0;
  color: var(--bb-soft);
  font-size: 1.02rem;
}

.bbHeroChips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.bbBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #f2dfb7;
  font-weight: 800;
  text-align: center;
}

.bbBadgeRound {
  background: linear-gradient(180deg, #fff3d9, #ffe7b3);
}

.bbError {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff0f0;
  border: 2px solid #f1bbbb;
  color: var(--bb-danger);
  font-weight: 700;
}

.bbMatchupPanel {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(240, 215, 168, 0.9);
  border-radius: var(--bb-radius-xl);
  box-shadow: var(--bb-shadow);
  padding: 22px;
}

.bbPanelHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.bbPanelHeader h3 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 1.8vw, 2rem);
}

.bbPanelHeader p {
  margin: 0;
  color: var(--bb-soft);
  font-weight: 600;
}

.bbPanelMeta {
  min-width: 260px;
  display: grid;
  gap: 10px;
}

.bbPanelNote {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff8ea;
  border: 2px solid #f2dfb7;
  font-weight: 700;
}

.bbBracketGrid {
  display: grid;
  grid-template-columns: 1fr 110px 1fr;
  gap: 18px;
  align-items: stretch;
}

.bbBookCard {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  background: #fffdf9;
  border: 2px solid var(--bb-card-border);
  border-radius: var(--bb-radius-lg);
  padding: 18px;
  box-shadow: 0 10px 24px rgba(103, 67, 23, 0.08);
}

.bbBookTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bbSeedPill,
.bbStatusPill {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.92rem;
  background: #fff5df;
  border: 2px solid #f2dfb7;
}

.bbStatusPill {
  background: #f8fff8;
}

.bbCoverWrap {
  width: 100%;
  aspect-ratio: 0.74 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff3d8, #ffe4b6);
  border: 2px solid #f1d5a0;
}

.bbCover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff4dc;
}

.bbBookBody h4 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.14;
}

.bbBookBody p {
  margin: 0;
  color: var(--bb-soft);
  font-weight: 700;
}

.bbCardActions {
  display: grid;
  gap: 10px;
}

.bbVsWrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bbVsBubble {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffb84c, #ff931e);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(255, 159, 28, 0.28);
  border: 4px solid #fff2d7;
}

.bbTeacherPanel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #fff8ef;
  border: 2px dashed #f0be74;
  display: grid;
  gap: 12px;
}

.bbTeacherPanel p {
  margin: 4px 0 0;
  color: var(--bb-soft);
}

.bbTeacherActions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.bbNavBar {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bbBtn {
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.bbBtn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.bbBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bbBtnPrimary {
  background: linear-gradient(180deg, var(--bb-primary-2), var(--bb-primary));
  color: #fff;
  box-shadow: 0 10px 18px rgba(255, 159, 28, 0.22);
}

.bbBtnVote {
  background: linear-gradient(180deg, #8b5cf6, #6d28d9);
  color: #fff;
  box-shadow: 0 10px 18px rgba(109, 40, 217, 0.2);
}

.bbBtnSecondary {
  background: #fff;
  color: var(--bb-text);
  border: 2px solid #ead6aa;
}

.bbBtnWarn {
  background: linear-gradient(180deg, #ffb15a, #ef6c00);
  color: #fff;
  box-shadow: 0 10px 18px rgba(239, 108, 0, 0.18);
}

.bbInput {
  min-height: 52px;
  border-radius: 16px;
  border: 2px solid #e8d7b7;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bb-text);
  background: #fff;
}

.bbModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.bbModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(41, 28, 10, 0.55);
}

.bbModalCard {
  position: relative;
  z-index: 2;
  width: min(1100px, calc(100% - 18px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
  background: #fffdf9;
  border-radius: 28px;
  border: 2px solid #edd5a3;
  box-shadow: 0 18px 46px rgba(27, 18, 4, 0.32);
  padding: 18px;
}

.bbModalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bbModalHeader h3 {
  margin: 0 0 6px;
}

.bbModalHeader p {
  margin: 0;
  color: var(--bb-soft);
  font-weight: 700;
}

.bbIconBtn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 2px solid #ead6aa;
  background: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}

.bbPlayerWrap {
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  border: 2px solid #e7d8bb;
}

.bbPlayerMount {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 260px;
}

.bbPlayerInfo {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.bbPlayerStatus,
.bbPlayerProgressText {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff7e8;
  border: 2px solid #efd8a8;
  font-weight: 800;
}

.bbLoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(255, 247, 239, 0.82);
  display: grid;
  place-items: center;
}

.bbLoadingOverlay.isHidden {
  display: none;
}

.bbLoadingCard {
  min-width: 220px;
  padding: 24px 28px;
  border-radius: 24px;
  background: #fff;
  border: 2px solid #efd7a8;
  box-shadow: var(--bb-shadow);
  text-align: center;
}

.bbSpinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 4px solid #f6dba8;
  border-top-color: var(--bb-primary);
  animation: bbSpin 0.9s linear infinite;
}

@keyframes bbSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .bbHero {
    grid-template-columns: 1fr;
  }

  .bbHeroChips {
    justify-content: flex-start;
  }

  .bbBracketGrid {
    grid-template-columns: 1fr;
  }

  .bbVsWrap {
    min-height: 40px;
  }

  .bbVsBubble {
    width: 64px;
    height: 64px;
    font-size: 1.1rem;
  }
}

@media (max-width: 720px) {
  .bbShell {
    width: min(100% - 12px, 100%);
    padding-top: 10px;
  }

  .bbHero,
  .bbMatchupPanel {
    padding: 14px;
    border-radius: 22px;
  }

  .bbPanelHeader {
    flex-direction: column;
  }

  .bbPanelMeta {
    min-width: 0;
    width: 100%;
  }

  .bbTeacherActions {
    grid-template-columns: 1fr;
  }

  .bbNavBar {
    flex-direction: column;
  }

  .bbBtn {
    width: 100%;
  }
}