/* Pack Briefing Modal — chat-first redesign */
.pb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 22, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@media (min-width: 721px) {
  .pb-overlay { align-items: center; }
}

/* Themed thin scrollbar */
.pb-overlay,
.pb-overlay * {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 136, 0.35) transparent;
}
.pb-overlay::-webkit-scrollbar,
.pb-overlay *::-webkit-scrollbar { width: 6px; height: 6px; }
.pb-overlay::-webkit-scrollbar-track,
.pb-overlay *::-webkit-scrollbar-track { background: transparent; }
.pb-overlay::-webkit-scrollbar-thumb,
.pb-overlay *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.35), rgba(0, 200, 110, 0.25));
  border-radius: 3px;
}
.pb-overlay::-webkit-scrollbar-thumb:hover,
.pb-overlay *::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.55), rgba(0, 200, 110, 0.4));
}
.pb-overlay.active { opacity: 1; pointer-events: auto; }

.pb-modal {
  position: relative;
  width: 100%;
  max-width: 920px;
  background: linear-gradient(160deg, #0f1530 0%, #1a1e3a 100%);
  border: 1px solid rgba(0, 255, 136, 0.18);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(0, 255, 136, 0.05),
              inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 721px) {
  .pb-modal { max-height: 88vh; }
}
.pb-overlay.active .pb-modal { transform: translateY(0) scale(1); }

.pb-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #8892b0;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s;
}
.pb-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; transform: rotate(90deg); }

/* LEFT: Hound */
.pb-hound {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(0, 255, 136, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, #0a0e27 0%, #161a35 100%);
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid rgba(0, 255, 136, 0.08);
}
.pb-hound::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(0, 255, 136, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(0, 200, 255, 0.04) 0%, transparent 40%);
  pointer-events: none;
}
.pb-hound-img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 12px 30px rgba(0, 255, 136, 0.25));
  position: relative;
  z-index: 1;
  animation: pbHoundIdle 4s ease-in-out infinite;
}
@keyframes pbHoundIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.pb-streak {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(255, 107, 0, 0.18), rgba(255, 165, 0, 0.10));
  border: 1px solid rgba(255, 140, 0, 0.35);
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: #ffd180;
  position: relative;
  z-index: 1;
}
.pb-streak-flame { font-size: 18px; line-height: 1; }
.pb-streak-num { color: #fff; font-size: 17px; }
.pb-streak-label { font-size: 11px; color: #ffb066; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.pb-streak.zero {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: #8892b0;
}
.pb-streak.zero .pb-streak-num { color: #c8d0e0; }

.pb-best {
  margin-top: 8px;
  font-size: 11px;
  color: #6a7390;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: relative;
  z-index: 1;
}
.pb-best b { color: #00ff88; font-weight: 700; }

/* Tagline under hound */
.pb-hound-tag {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 255, 136, 0.15);
  border-radius: 12px;
  font-size: 12.5px;
  color: #c8d0e0;
  line-height: 1.45;
  text-align: center;
  position: relative;
  z-index: 1;
  font-style: italic;
}
.pb-hound-tag::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 1px solid rgba(0, 255, 136, 0.15);
  border-top: 1px solid rgba(0, 255, 136, 0.15);
}

/* RIGHT: Content — chat-first */
.pb-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.pb-header {
  padding: 22px 28px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.04) 0%, transparent 100%);
}
.pb-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #00ff88;
  margin-bottom: 6px;
}
.pb-title {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.25;
}

/* CHAT — the hero */
.pb-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 28px 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 255, 136, 0.04) 0%, transparent 60%);
}
.pb-chat-log {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 4px 14px;
  min-height: 0;
  /* Hard cap so long AI responses always scroll instead of pushing the input
     and close button off-screen (the user reported being "stuck" otherwise). */
  max-height: 52vh;
  /* Subtle scrollbar — visible enough to discover, not loud. */
  scrollbar-gutter: stable;
}
.pb-chat-log:empty { padding: 0; }
.pb-msg {
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 88%;
  animation: pbMsgIn 0.25s ease;
}
@keyframes pbMsgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.pb-msg.user {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.14), rgba(0, 200, 110, 0.08));
  border: 1px solid rgba(0, 255, 136, 0.28);
  color: #ecfff5;
  align-self: flex-end;
}
.pb-msg.hound {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d4dceb;
  align-self: flex-start;
  position: relative;
  padding-left: 36px;
}
.pb-msg.hound::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: url('/webpictures/TheHound_head.png') center/cover no-repeat, #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.4);
}
.pb-msg.typing {
  color: #6a7390;
  font-style: italic;
}

/* Hound reply: structured rendering for bullets + per-line picks. */
.pb-msg.hound .pb-line {
  margin: 0 0 6px;
  line-height: 1.45;
}
.pb-msg.hound .pb-line:last-child { margin-bottom: 0; }
.pb-msg.hound .pb-bullets {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.pb-msg.hound .pb-bullets li {
  position: relative;
  padding: 4px 0 4px 16px;
  line-height: 1.45;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.pb-msg.hound .pb-bullets li:first-child { border-top: none; }
.pb-msg.hound .pb-bullets li::before {
  content: "•";
  color: #00ff88;
  position: absolute;
  left: 2px;
  top: 4px;
  font-weight: 700;
}
.pb-msg.hound strong {
  color: #ffffff;
  font-weight: 600;
}

/* Suggestions — empty-state cards (ChatGPT style) */
.pb-suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 4px 0 14px;
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.3s ease;
  overflow: hidden;
}
.pb-suggestions.collapsed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  pointer-events: none;
}
.pb-sugg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.06), rgba(0, 255, 136, 0.02));
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 14px;
  color: #d4dceb;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  font-family: inherit;
  line-height: 1.35;
}
.pb-sugg:hover {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.14), rgba(0, 255, 136, 0.06));
  border-color: rgba(0, 255, 136, 0.5);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 255, 136, 0.15);
}
.pb-sugg-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.pb-sugg-text { flex: 1; min-width: 0; }
.pb-sugg-hint {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #00ff88;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 2px;
  opacity: 0.85;
}
.pb-sugg-q { display: block; color: inherit; }

.pb-chat-form {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}
.pb-chat-input {
  flex: 1;
  padding: 13px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid rgba(0, 255, 136, 0.22);
  border-radius: 12px;
  color: #fff;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.pb-chat-input:focus {
  border-color: rgba(0, 255, 136, 0.55);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.08);
}
.pb-chat-input::placeholder { color: #6a7390; }
.pb-chat-send {
  padding: 0 22px;
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  color: #0a0e27;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  transition: all 0.2s;
}
.pb-chat-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 255, 136, 0.3); }
.pb-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* COMPACT FOOTER STRIP — challenges + sports as one row */
.pb-strip {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pb-strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}
.pb-strip-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #8892b0;
  white-space: nowrap;
}
.pb-strip-label b { color: #00ff88; }
.pb-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pb-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s;
  cursor: pointer;
}
.pb-dot.done {
  background: #00ff88;
  border-color: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}
.pb-dot[title] { cursor: help; }

.pb-strip-action {
  background: none;
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: #00ff88;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: all 0.2s;
}
.pb-strip-action:hover { background: rgba(0, 255, 136, 0.1); }

/* Expanded challenge details (revealed on click) */
.pb-challenges-detail {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 28px;
  background: rgba(0, 0, 0, 0.15);
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.pb-challenges-detail.open { display: flex; }
.pb-challenge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 12.5px;
}
.pb-challenge.done { background: rgba(0, 255, 136, 0.06); border-color: rgba(0, 255, 136, 0.25); }
.pb-challenge-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}
.pb-challenge.done .pb-challenge-check { background: #00ff88; border-color: #00ff88; color: #0a0e27; }
.pb-challenge-name { color: #fff; flex: 1; font-weight: 500; }
.pb-challenge.done .pb-challenge-name { color: #4dffaa; }
.pb-challenge-reward {
  font-size: 11px;
  color: #ffd180;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}
.pb-challenge-reward img { width: 12px; height: 12px; }

/* Mobile */
@media (max-width: 720px) {
  .pb-modal {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .pb-content { overflow: visible; }
  /* Mobile: keep the chat log scrollable inside the modal so long answers
     don't push the input off-screen. */
  .pb-chat-log { overflow-y: auto; overflow-x: hidden; max-height: 45vh; min-height: 0; flex: 1 1 auto; }
  .pb-suggestions { grid-template-columns: 1fr; gap: 8px; }
  .pb-sugg { padding: 12px 14px; font-size: 13px; }
  .pb-hound { padding: 22px 18px 14px; border-right: none; border-bottom: 1px solid rgba(0, 255, 136, 0.08); }
  .pb-hound-img { width: 130px; height: 130px; }
  .pb-hound-tag { font-size: 12px; }
  .pb-header { padding: 16px 20px 10px; }
  .pb-title { font-size: 17px; }
  .pb-chat { padding: 12px 18px 10px; }
  .pb-strip { padding: 10px 18px; }
  .pb-challenges-detail { padding: 10px 18px; }
}

/* "Don't show this automatically" preference toggle */
.pb-prefs {
  padding: 12px 26px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.pb-prefs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  user-select: none;
}
.pb-prefs-toggle input {
  width: 15px;
  height: 15px;
  accent-color: #00ff88;
  cursor: pointer;
}
.pb-prefs-toggle:hover { color: rgba(255, 255, 255, 0.8); }
@media (max-width: 720px) {
  .pb-prefs { padding: 10px 18px 16px; }
}
