/* ===============================================================
   Bad Bets — Brag-card share modal (used by bb-brag.js)
   =============================================================== */

.bb-brag-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 14px 30px;
  overflow-y: auto;
  animation: bbBragFade 0.18s ease-out;
}
@keyframes bbBragFade { from { opacity: 0 } to { opacity: 1 } }

.bb-brag-shell {
  width: 100%; max-width: 540px;
  background: #0b0d12;
  border: 1px solid rgba(255, 170, 0, 0.22);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  margin-top: 30px;
}

.bb-brag-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 14px;
}
.bb-brag-title {
  font-family: var(--font-display, 'Big Shoulders Display'), sans-serif;
  font-weight: 900; font-size: 22px; color: var(--amber, #ffaa00);
  letter-spacing: 0.5px;
}
.bb-brag-sub {
  font-size: 12px; color: var(--muted, #9b9890);
  margin-top: 2px; letter-spacing: 0.4px;
}
.bb-brag-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); color: var(--text, #f0eee6);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer; font-size: 14px;
}
.bb-brag-close:hover { background: rgba(255, 170, 0, 0.18); color: var(--amber, #ffaa00); }

/* Format selector chips */
.bb-brag-formats {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.bb-brag-fmt {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--muted, #9b9890);
  padding: 9px 12px; border-radius: 10px;
  font-family: var(--font-display, 'Big Shoulders Display'), sans-serif;
  font-weight: 800; font-size: 13px;
  letter-spacing: 0.4px; cursor: pointer;
  transition: all 0.12s ease;
}
.bb-brag-fmt:hover { color: var(--text, #f0eee6); border-color: rgba(255, 170, 0, 0.4); }
.bb-brag-fmt.is-active {
  background: rgba(255, 170, 0, 0.18);
  color: var(--amber, #ffaa00);
  border-color: rgba(255, 170, 0, 0.5);
}

/* Canvas preview area */
.bb-brag-preview {
  background: #050709;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  /* Cap the preview height so the action buttons stay above the keyboard / nav. */
  max-height: 70vh;
  overflow: hidden;
}
/* Canvas elements don't auto-preserve aspect ratio when BOTH max-width and
   max-height clamp (browser will stretch). Per-format CSS aspect-ratio +
   explicit width/height: auto forces the natural ratio to win. */
.bb-brag-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.bb-brag-canvas[data-format="1:1"] { aspect-ratio: 1 / 1; }
.bb-brag-canvas[data-format="4:5"] { aspect-ratio: 4 / 5; }

.bb-brag-loading {
  color: var(--muted, #9b9890); font-size: 14px;
}

/* Actions */
.bb-brag-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.bb-brag-actions .bb-brag-copylink { grid-column: 1 / -1; }
.bb-brag-actions button {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--font-display, 'Big Shoulders Display'), sans-serif;
  font-weight: 800; font-size: 14px;
  letter-spacing: 0.4px; cursor: pointer;
  transition: all 0.12s ease;
}
.bb-brag-share {
  background: var(--amber, #ffaa00); color: #000;
  border-color: var(--amber, #ffaa00);
}
.bb-brag-share:hover { background: #ffc340; }
.bb-brag-download {
  background: rgba(255, 170, 0, 0.18); color: var(--amber, #ffaa00);
  border-color: rgba(255, 170, 0, 0.5);
}
.bb-brag-download:hover { background: rgba(255, 170, 0, 0.28); }
.bb-brag-copylink {
  background: rgba(255, 255, 255, 0.04); color: var(--text, #f0eee6);
}
.bb-brag-copylink:hover { background: rgba(255, 255, 255, 0.08); }

.bb-brag-tip {
  font-size: 11px; color: var(--muted, #9b9890);
  text-align: center; padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.5;
}

/* Mobile tightening — give the preview as much breathing room as possible */
@media (max-width: 480px) {
  .bb-brag-modal {
    padding: max(8px, env(safe-area-inset-top)) 8px 14px;
  }
  .bb-brag-shell {
    padding: 12px 12px 10px;
    margin-top: 6px;
    border-radius: 14px;
  }
  .bb-brag-head { margin-bottom: 10px; gap: 8px; }
  .bb-brag-title { font-size: 18px; }
  .bb-brag-sub { font-size: 11px; }
  .bb-brag-formats { margin-bottom: 10px; gap: 6px; }
  .bb-brag-fmt { padding: 8px 10px; font-size: 12px; }

  /* The preview: lock to viewport-aware bounds and reduce padding so a
     1080-square actually has room to render without squishing. */
  .bb-brag-preview {
    padding: 8px;
    margin-bottom: 10px;
    min-height: 220px;
    /* Cap at ~55vh so the action buttons stay above the bottom nav bar */
    max-height: min(55vh, 460px);
  }
  .bb-brag-canvas {
    max-height: 100%;
  }

  .bb-brag-actions {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 4px;
  }
  .bb-brag-actions .bb-brag-copylink { grid-column: auto; }
  .bb-brag-actions button { padding: 10px 12px; font-size: 13px; }
  .bb-brag-tip { font-size: 10px; padding-top: 6px; line-height: 1.4; }
}

/* Very tall narrow screens (iPhone Pro Max etc) — let the preview breathe more */
@media (max-width: 480px) and (min-height: 800px) {
  .bb-brag-preview { max-height: min(60vh, 560px); }
}

/* The trigger button itself — used on pick cards site-wide */
.bb-share-btn {
  background: rgba(255, 170, 0, 0.14);
  border: 1px solid rgba(255, 170, 0, 0.32);
  color: var(--amber, #ffaa00);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px; letter-spacing: 0.5px;
  font-family: var(--font-display, 'Big Shoulders Display'), sans-serif;
  font-weight: 800;
  cursor: pointer; transition: all 0.12s ease;
}
.bb-share-btn:hover {
  background: rgba(255, 170, 0, 0.25);
  border-color: var(--amber, #ffaa00);
}
