/* ═══════════════════════════════════════════════════════════
   Play Select — shared playful selection tabs / filter chips
   Used by Projects, Funding, Community, Quests, Marketplace,
   Wallet, Inventory, Opportunities, Project Detail.
   ═══════════════════════════════════════════════════════════ */

@keyframes play-tab-pop {
  0%   { transform: scale(0.88); }
  55%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes play-tab-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@keyframes play-tab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.68 0.28 295 / 0.35); }
  50%      { box-shadow: 0 0 0 6px oklch(0.68 0.28 295 / 0); }
}

@keyframes play-tab-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.65; }
}

/* ── Segmented track (Projects / Funding / Community / Quests) ── */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  border-radius: 16px;
  border: 1px solid oklch(1 0 0 / 0.08);
  background:
    linear-gradient(180deg, oklch(0.18 0.03 285 / 0.9), oklch(0.12 0.025 270 / 0.95)),
    var(--bg-raised);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.06),
    0 8px 24px oklch(0 0 0 / 0.28);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.2s var(--smooth),
    transform 0.22s var(--spring),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.tab-btn .play-tab-mark {
  font-size: 11px;
  opacity: 0.7;
}
.tab-btn:hover .play-tab-mark {
  opacity: 1;
  transform: scale(1.15) rotate(-8deg);
}
.tab-btn.on .play-tab-mark {
  opacity: 1;
}
.tab-btn::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 0;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform: translateX(-50%);
  opacity: 0;
  transition: width 0.22s var(--spring), opacity 0.18s ease;
}
.tab-btn:hover {
  color: var(--text);
  transform: translateY(-1px);
}
.tab-btn:active { transform: translateY(0) scale(0.96); }
.tab-btn.on {
  color: var(--text);
  border-color: oklch(0.68 0.28 295 / 0.45);
  background:
    linear-gradient(135deg,
      oklch(0.42 0.18 295 / 0.55),
      oklch(0.35 0.14 220 / 0.45),
      oklch(0.38 0.16 135 / 0.28));
  background-size: 180% 180%;
  animation: play-tab-pop 0.38s var(--spring), play-tab-shimmer 2.8s ease infinite alternate;
  box-shadow:
    0 0 0 1px oklch(0.68 0.28 295 / 0.18),
    0 6px 18px oklch(0.45 0.2 295 / 0.28),
    inset 0 1px 0 oklch(1 0 0 / 0.12);
}
.tab-btn.on::before {
  width: 14px;
  opacity: 1;
  bottom: 4px;
  animation: play-tab-dot 1.6s ease-in-out infinite;
}

/* ── Loose chips (Marketplace / Wallet / Opportunity filters) ── */
.bc-tabs,
.opp-filters,
.inv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.bc-tabs {
  max-width: 1100px;
  margin: 0 auto 18px;
  padding: 0 var(--page-px, 24px);
}

.bc-tabs--primary {
  gap: 10px;
  padding-bottom: 4px;
}

.bc-tab,
.opp-filter-chip,
.inv-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid oklch(1 0 0 / 0.10);
  background:
    linear-gradient(180deg, oklch(0.16 0.02 270 / 0.85), oklch(0.12 0.02 270 / 0.9));
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.22s var(--spring),
    box-shadow 0.22s ease;
}
.bc-tab::after,
.opp-filter-chip::after,
.inv-tab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 20%, oklch(1 0 0 / 0.14), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.bc-tab:hover,
.opp-filter-chip:hover,
.inv-tab:hover {
  color: var(--text);
  border-color: oklch(1 0 0 / 0.22);
  transform: translateY(-2px) rotate(-0.4deg);
  box-shadow: 0 8px 18px oklch(0 0 0 / 0.28);
}
.bc-tab:hover::after,
.opp-filter-chip:hover::after,
.inv-tab:hover::after { opacity: 1; }
.bc-tab:active,
.opp-filter-chip:active,
.inv-tab:active {
  transform: translateY(0) scale(0.96) rotate(0deg);
}

/* Marketplace / wallet accent — amber */
.bc-tab.on {
  color: oklch(0.14 0.02 85);
  border-color: transparent;
  background: linear-gradient(135deg, var(--amber), oklch(0.86 0.18 110), var(--lime));
  background-size: 160% 160%;
  animation: play-tab-pop 0.38s var(--spring), play-tab-shimmer 2.4s ease infinite alternate;
  box-shadow:
    0 0 0 1px oklch(0.80 0.20 68 / 0.35),
    0 8px 22px oklch(0.80 0.20 68 / 0.28),
    inset 0 1px 0 oklch(1 0 0 / 0.35);
}
.bc-tab.on::after { opacity: 0.35; }

/* Opportunity filters — violet / cyan */
.opp-filter-chip.on {
  color: var(--text);
  border-color: oklch(0.68 0.28 295 / 0.55);
  background: linear-gradient(135deg,
    oklch(0.40 0.18 295 / 0.65),
    oklch(0.38 0.14 220 / 0.45));
  background-size: 160% 160%;
  animation: play-tab-pop 0.38s var(--spring), play-tab-shimmer 2.6s ease infinite alternate;
  box-shadow:
    0 0 0 1px oklch(0.68 0.28 295 / 0.25),
    0 8px 20px oklch(0.45 0.2 295 / 0.3);
}

/* Inventory — amber game chips */
.inv-tabs { margin-bottom: 10px; }
.inv-tab em {
  font-style: normal;
  font-size: 8px;
  padding: 2px 6px;
  border-radius: 99px;
  background: oklch(0.2 0.03 270);
  color: var(--text-faint);
  transition: background 0.2s ease, color 0.2s ease;
}
.inv-tab.on {
  color: oklch(0.14 0.02 85);
  border-color: transparent;
  background: linear-gradient(135deg, var(--amber), oklch(0.84 0.17 95));
  background-size: 160% 160%;
  animation: play-tab-pop 0.38s var(--spring), play-tab-shimmer 2.4s ease infinite alternate;
  box-shadow: 0 8px 20px oklch(0.80 0.20 68 / 0.28);
}
.inv-tab.on em {
  background: oklch(0.14 0.02 85 / 0.18);
  color: oklch(0.14 0.02 85);
}

/* ── Project detail tabs — playful segmented strip ── */
.proj-detail-tab-bar {
  display: flex;
  gap: 4px;
  margin-top: 20px;
  margin-bottom: 24px;
  padding: 5px;
  border: 1px solid oklch(1 0 0 / 0.08);
  border-radius: 16px;
  border-bottom: 1px solid oklch(1 0 0 / 0.08);
  background:
    linear-gradient(180deg, oklch(0.18 0.03 285 / 0.9), oklch(0.12 0.025 270 / 0.95));
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.06);
  overflow-x: auto;
  scrollbar-width: none;
}
.proj-detail-tab-bar::-webkit-scrollbar { display: none; }

.proj-detail-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.22s var(--spring),
    box-shadow 0.22s ease;
}
.proj-detail-tab .play-tab-mark { opacity: 0.7; }
.proj-detail-tab.on .play-tab-mark,
.proj-detail-tab:hover .play-tab-mark { opacity: 1; }
.proj-detail-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}
.proj-detail-tab.on {
  color: var(--text);
  border-color: oklch(0.68 0.28 295 / 0.4);
  background: linear-gradient(135deg,
    oklch(0.42 0.18 295 / 0.55),
    oklch(0.36 0.14 200 / 0.4));
  background-size: 160% 160%;
  animation: play-tab-pop 0.38s var(--spring), play-tab-shimmer 2.6s ease infinite alternate;
  box-shadow:
    0 6px 16px oklch(0.45 0.2 295 / 0.28),
    inset 0 1px 0 oklch(1 0 0 / 0.12);
}

/* ── Category icon inside marketplace chips ── */
.bc-tab .bc-cat-icon,
.bc-cat-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  filter: grayscale(0.3) brightness(1.1);
  transition: transform 0.22s var(--spring), filter 0.2s ease;
}
.bc-tab:hover .bc-cat-icon { transform: scale(1.12) rotate(-6deg); filter: none; }
.bc-tab.on .bc-cat-icon {
  filter: brightness(0.25);
  transform: scale(1.08);
}

/* Primary marketplace / wallet row — larger “mode” tabs */
.bc-tabs--primary .bc-tab {
  padding: 11px 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  border-radius: 14px;
}
.bc-tabs--primary .bc-tab:not(.on) {
  border-color: oklch(1 0 0 / 0.12);
  background: oklch(0.14 0.025 270 / 0.75);
}
.bc-tabs--primary .bc-tab--link:not(.on) {
  border-style: dashed;
  color: var(--text-faint);
}
.play-tab-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  font-size: 12px;
  line-height: 1;
  opacity: 0.75;
  transition: transform 0.22s var(--spring), opacity 0.2s ease;
}
.bc-tab:hover .play-tab-mark {
  opacity: 1;
  transform: scale(1.15) rotate(-8deg);
}
.bc-tab.on .play-tab-mark {
  opacity: 1;
  transform: scale(1.1);
}
.bc-tabs--chips {
  gap: 7px;
}
.bc-tabs--chips .bc-tab {
  padding: 7px 12px;
  font-size: 9.5px;
}

/* Focus / a11y */
.tab-btn:focus-visible,
.bc-tab:focus-visible,
.opp-filter-chip:focus-visible,
.inv-tab:focus-visible,
.proj-detail-tab:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .tab-bar { width: 100%; }
  .tab-btn { padding: 9px 12px; font-size: 9.5px; }
  .bc-tabs--primary .bc-tab { padding: 10px 14px; font-size: 10px; }
  .proj-detail-tab { padding: 10px 10px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .tab-btn,
  .bc-tab,
  .opp-filter-chip,
  .inv-tab,
  .proj-detail-tab {
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease !important;
    animation: none !important;
  }
  .tab-btn:hover,
  .bc-tab:hover,
  .opp-filter-chip:hover,
  .inv-tab:hover,
  .proj-detail-tab:hover {
    transform: none;
  }
}


/* ═══════════════════════════════════════════════════════════
   Marketplace tab rows — refined sizing + grouping
   Loaded last in this file so it settles the shared .bc-tab
   rules above without touching .opp-filter-chip / .inv-tab.
   ═══════════════════════════════════════════════════════════ */

/* ── Primary row: segmented tabs, then a separated nav group ── */
.bc-tabs--primary {
  gap: 12px;
  align-items: center;
  row-gap: 10px;
}
.bc-tabset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
/* the three real tabs read as one segmented control */
.bc-tabs--primary .bc-tabset:not(.bc-tabset--nav) {
  padding: 5px;
  border-radius: 18px;
  background: oklch(0.10 0.02 270 / 0.55);
  box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.09);
}
.bc-tabset--nav { gap: 8px; }

.bc-tabs-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, oklch(1 0 0 / 0.20), transparent);
}

/* ── Sizing: the old 9.5–11px uppercase mono was under-set ── */
.bc-tab { gap: 8px; }
.bc-tabs--primary .bc-tab {
  padding: 11px 18px;
  font-size: 11.5px;
  letter-spacing: 0.09em;
  border-radius: 13px;
}
.bc-tabs--chips { gap: 8px; }
.bc-tabs--chips .bc-tab {
  padding: 8px 13px;
  font-size: 10.5px;
  letter-spacing: 0.07em;
}
.bc-tab .bc-cat-icon,
.bc-tabs--chips .bc-cat-icon {
  width: 18px;
  height: 18px;
  /* the source art is square PNG tiles — round them so they read as
     icons rather than tiny photographs */
  border-radius: 5px;
  filter: grayscale(0.15) brightness(1.12);
}
.bc-tab .play-tab-mark {
  font-size: 13px;
  width: 1.15em;
}

/* nav links: secondary, not dashed-and-faded like a placeholder */
.bc-tabs--primary .bc-tab--link:not(.on) {
  border-style: solid;
  border-color: oklch(1 0 0 / 0.10);
  background: transparent;
  color: var(--text-dim);
}
.bc-tabs--primary .bc-tab--link:not(.on):hover {
  border-color: oklch(1 0 0 / 0.22);
  background: oklch(0.14 0.025 270 / 0.7);
  color: var(--text);
}

/* ── Calmer motion ───────────────────────────────────────────
   The selected chip ran play-tab-shimmer infinitely — two of
   them animating at once pulled the eye off the grid. Keep the
   pop on select, drop the perpetual shimmer. Hover also
   rotated -0.4deg, which jittered the uppercase text. */
.bc-tab.on {
  background: linear-gradient(135deg, var(--amber), oklch(0.86 0.18 108));
  background-size: 100% 100%;
  animation: play-tab-pop 0.34s var(--spring);
}
.bc-tab:hover { transform: translateY(-2px); }
.bc-tab:active { transform: translateY(0) scale(0.96); }
.bc-tab:hover .play-tab-mark { transform: scale(1.12); }
.bc-tab:hover .bc-cat-icon { transform: scale(1.1); filter: none; }

/* ── Mobile: scroll the categories instead of stacking rows ── */
@media (max-width: 768px) {
  .bc-tabs--chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* room for the hover lift and focus ring inside the scroller */
    padding-block: 4px;
  }
  .bc-tabs--chips::-webkit-scrollbar { display: none; }
  /* No scroll-snap here: `scroll-snap-align: start` aligns to the
     scrollport edge and ignores the row's page padding, which parks
     the first chip flush against the viewport. */
  .bc-tabs--chips .bc-tab { flex: 0 0 auto; }
  .bc-tabs--primary { gap: 8px; }
  .bc-tabs--primary .bc-tab { padding: 10px 14px; font-size: 10.5px; }
  .bc-tabs-sep { display: none; }
}

/* Re-assert reduced motion: the rules above are appended after this
   file's original prefers-reduced-motion block and would outrank it. */
@media (prefers-reduced-motion: reduce) {
  .bc-tab:hover,
  .bc-tab:active { transform: none; }
  .bc-tab:hover .play-tab-mark,
  .bc-tab:hover .bc-cat-icon { transform: none; }
}
