/* ============================================================================
   chrome/layout/picker.css · WEEK82 (T1)
   Bot picker (#bot-picker) modal styles. Functional stopgap restored from
   index_legacy.html (~456-462 popup shell · ~1148-1162 glass base ·
   ~1193-1396 picker grid + cards + featured tile). A DSv2-polished picker
   will follow with the platform lobby per WEEK82 §1.

   TOKEN DISCIPLINE (chrome-foundation.test.js):
     - No literal 6-digit hex — legacy dark-frame values use the
       --rd-avatar-grad-from / --rd-avatar-grad-to tokens in chrome/tokens.css.
     - No rgba() with a brand-token RGB triple (gold, dark, cream) — every
       gold alpha goes through a --rd-gold-* translucent-variant token.
       A few legacy alphas snap to the closest available token (visual
       drift accepted per WEEK82 §8 risk #1).
     - Pure-neutral rgba(0,0,0,a) and rgba(255,255,255,a) are allowed
       and kept verbatim (the rule explicitly excludes neutrals).
   ============================================================================ */

/* Popup shell — fixed full-viewport host with the legacy glass backdrop. */
#bot-picker {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
#bot-picker.open { display: flex; }

/* Glass popup card. */
#bot-picker .popup-card {
  background: var(--rd-glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
  backdrop-filter: blur(22px) saturate(1.1);
  border: 1px solid var(--rd-glass-border);
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 28px;
  width: min(720px, 92%);
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
}

#bot-picker .popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
#bot-picker .popup-title {
  font-family: var(--rd-font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--rd-cream);
  margin: 0;
}
#bot-picker .popup-close {
  background: transparent;
  border: none;
  color: var(--rd-cream-dim);
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
#bot-picker .popup-close:hover { color: var(--rd-cream); }

#bot-picker .bot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: transparent;
}

.bot-card {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 180ms ease;
  font-family: inherit;
  color: inherit;
  text-align: center;
  width: auto;
  min-width: 0;
}
.bot-card:hover {
  /* legacy gold-alpha 0.5 snaps to --rd-line-strong (0.45) */
  border-color: var(--rd-line-strong);
  background: rgba(0, 0, 0, 0.28);
}
.bot-card.selected {
  border-color: var(--rd-gold);
  /* legacy gold-alpha 0.05 snaps to --rd-gold-hover-subtle (0.10) */
  background: var(--rd-gold-hover-subtle);
  box-shadow:
    0 0 0 1px var(--rd-gold),
    /* legacy gold-alpha 0.18 inset — exact match --rd-line */
    0 0 32px var(--rd-line) inset,
    /* legacy gold-alpha 0.15 outer — exact match --rd-gold-hover */
    0 0 24px var(--rd-gold-hover);
}

.bot-card .bot-avatar {
  width: 88px;
  height: 100px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--rd-avatar-grad-from), var(--rd-avatar-grad-to));
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 4px;
  display: block;
  font-size: 0;
}
.bot-card .bot-avatar > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  display: block;
}

.bot-flag {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: block;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.bot-flag svg { width: 100%; height: 100%; display: block; }

.bot-card .bot-name {
  font-family: var(--rd-font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--rd-cream);
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.bot-card .bot-elo {
  font-family: var(--rd-font-action);
  font-size: 11px;
  font-weight: 500;
  color: var(--rd-gold);
  letter-spacing: 0.5px;
}
.bot-card .bot-bio {
  font-family: var(--rd-font-serif);
  font-style: italic;
  font-size: 11px;
  line-height: 1.35;
  color: var(--rd-cream-dim);
  margin-top: 2px;
  min-height: 28px;
}

/* Featured Grandmaster tile (GG Guru) — appended last by renderBotGrid,
   spans the full grid width. */
.bot-featured {
  margin-top: 14px;
  padding: 16px 22px;
  border-radius: 8px;
  /* legacy gold-alpha 0.55 snaps to --rd-glass-border (0.40) */
  border: 1px solid var(--rd-glass-border);
  /* legacy gold-alpha gradient (start 0.10 / end 0.02) — start uses
     --rd-gold-hover-subtle (exact), end fades to transparent so we
     never inline a sub-token brand-RGB rgba(). */
  background: linear-gradient(180deg, var(--rd-gold-hover-subtle), transparent);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}
.bot-featured::before {
  content: 'GRANDMASTER';
  position: absolute;
  top: 8px;
  right: 18px;
  font-family: var(--rd-font-action);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--rd-gold);
  pointer-events: none;
}
.bot-featured:hover {
  border-color: var(--rd-gold);
  /* legacy gold-alpha gradient (start 0.16 / end 0.04) — snap start to
     --rd-gold-hover (0.15), end fades to transparent. */
  background: linear-gradient(180deg, var(--rd-gold-hover), transparent);
  /* legacy gold-alpha 0.18 inset — exact match --rd-line */
  box-shadow: 0 0 32px var(--rd-line) inset;
}
.bot-featured.selected {
  border-color: var(--rd-gold);
  box-shadow:
    0 0 0 1px var(--rd-gold),
    /* legacy gold-alpha 0.22 inset — snap to --rd-gold-fill (0.25) */
    0 0 32px var(--rd-gold-fill) inset;
}
.bot-featured-avatar {
  width: 92px;
  height: 105px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--rd-avatar-grad-from), var(--rd-avatar-grad-to));
  border: 2px solid var(--rd-gold);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  /* legacy gold-alpha 0.30 outer shadow — snap to --rd-gold-glow (0.35) */
  box-shadow: 0 0 20px var(--rd-gold-glow);
}
.bot-featured-avatar > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  display: block;
}
.bot-featured-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.bot-featured-name {
  font-family: var(--rd-font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--rd-cream);
  letter-spacing: 0.5px;
}
.bot-featured-elo {
  font-family: var(--rd-font-action);
  font-size: 12px;
  font-weight: 500;
  color: var(--rd-gold);
  letter-spacing: 1px;
}
.bot-featured-blurb {
  font-family: var(--rd-font-serif);
  font-style: italic;
  font-size: 12px;
  color: var(--rd-cream-dim);
  margin-top: 2px;
}
.bot-featured-cta {
  font-family: var(--rd-font-action);
  font-size: 11px;
  font-weight: 600;
  color: var(--rd-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid var(--rd-gold);
  border-radius: 6px;
  align-self: center;
  white-space: nowrap;
}
.bot-featured:hover .bot-featured-cta {
  background: var(--rd-gold);
  color: var(--rd-dark);
}

/* The featured tile must span the full grid width (renderBotGrid appends
   it as a child of #bot-grid, so without this it inherits the 3-col
   template). */
#bot-picker .bot-grid .bot-featured { grid-column: 1 / -1; }

@media (max-width: 700px) {
  #bot-picker .bot-grid { grid-template-columns: repeat(2, 1fr); }
  .bot-card .bot-avatar { width: 76px; height: 86px; }
}
