/* =========================================================================
   BOT ARENA — roster tiers, match stage, thinking bar, result overlay
   ========================================================================= */
.bots-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.bots-header h2 { font-size: 24px; margin-bottom: 6px; }
.bots-header .pane-text { color: var(--text-muted); }

/* ----- chess.com-style layout: a little live board on the left,
   the roster/hero/playbar on the right — mirrors chess.com's own
   bot-picker page so the screen never reads as empty on one side. ----- */
.bots-layout {
  display: flex;
  align-items: flex-start;
  gap: 26px;
}

/* Fixed width, chess.com style — the board never grows with the window.
   The roster on the right is capped to match its height exactly (see
   syncBotsColumnHeight() in js/bots.js) and scrolls internally instead —
   the page itself never scrolls. 380px is tested to be the biggest
   size that still fits a normal 1366×768 laptop screen with ZERO
   vertical scroll (grid + 2 rows of options + labels, all visible) —
   going wider clips the board's own bottom row instead, which is
   worse than not growing further. */
.bots-demo {
  flex: 0 0 380px;
  max-width: 380px;
  position: sticky;
  top: 20px;
}

.bots-demo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 24px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.bots-demo-label {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.bots-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-bottom: 15px;
}

.bots-demo-grid .matrix-cell {
  aspect-ratio: 1;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bots-demo-grid .matrix-cell svg { width: 84%; height: 84%; }

.bots-demo-grid .matrix-cell.blank-target {
  border: 2px dotted var(--accent-blue);
  background: rgba(59, 130, 246, .08);
  color: var(--accent-blue);
  font-size: 26px;
  font-weight: 800;
  animation: blank-pulse 1.7s ease-in-out infinite;
}

.bots-demo-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.bots-demo-options .option-card {
  aspect-ratio: 1;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bots-demo-options .option-card svg { width: 68%; height: 68%; }

.bots-demo-options .option-card-tag {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: .02em;
}

.bots-demo-options .option-card.correct {
  border: 3px solid var(--accent-emerald);
  background: rgba(16, 185, 129, .22);
  animation: pulse-green .55s ease, pop-card .5s ease;
}

.bots-demo-options .option-card.correct .option-card-tag { color: var(--accent-emerald); }

.bots-demo-options .option-card.wrong {
  border: 3px solid #EF4444;
  background: rgba(239, 68, 68, .16);
  animation: shake .3s ease;
}

.bots-demo-options .option-card.wrong .option-card-tag { color: #EF4444; }

/* The right column's height is set inline by syncBotsColumnHeight() in
   js/bots.js, measured off the rendered board card, so it always matches
   the left side exactly. It never scrolls itself — only the tier list
   inside it does. That's the chess.com split: a fixed board on the
   left, a capped scrollable roster on the right, NOT a page that
   scrolls the board out of view. */
.bots-main {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 16px;
}
#bots-tiers { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.bots-playbar { flex: 0 0 auto; }

@media (max-width: 860px) {
  .bots-layout { flex-direction: column; }
  .bots-demo { position: static; flex: 1 1 auto; width: 100%; max-width: 340px; margin: 0 auto; }
  .bots-main { height: auto; }
  #bots-tiers { overflow-y: visible; }
}

/* ----- The chosen rival, front and center (chess.com pattern) -----
   Bot portraits are ROUNDED SQUARES, chess.com style — they tile like
   cards in a grid, with a soft top-light so they read as little tiles. */
.bot-face {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(180deg, #343230, #232120);
  border: 2px solid var(--tier-color, var(--line));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08),
              0 3px 0 rgba(0, 0, 0, .35),
              0 0 12px color-mix(in srgb, var(--tier-color, transparent) 35%, transparent);
}

.bot-hero { display: flex; align-items: center; gap: 14px; }

.bot-hero-face { width: 68px; height: 68px; font-size: 36px; flex: 0 0 auto; border-radius: 19px; }

/* The speech bubble — bright against the dark shell, with a tail */
.bot-hero-bubble {
  position: relative;
  background: #f5f3f0;
  color: #262522;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 52ch;
}

.bot-hero-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right-color: #f5f3f0;
  border-left: none;
}

.bot-hero-meta { font-size: 14px; color: var(--text-muted); }
.bot-hero-meta b { font-size: 17px; color: var(--text-main); }
.bot-hero-stats b { color: var(--text-main); }

/* ----- Accordion tier shelves ----- */
.tier-acc {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}

.tier-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  font-size: 15px;
  transition: background .15s;
}

.tier-acc-head:hover { background: rgba(255, 255, 255, .04); }

.tier-acc-head b { font-size: 16.5px; }

.tier-acc-head small { margin-left: auto; color: var(--text-muted); font-weight: 700; font-size: 13px; }

/* The shelf's face: its strongest bot, ringed in the tier color */
.tier-face { width: 46px; height: 46px; font-size: 24px; flex: 0 0 auto; border-radius: 13px; }

.tier-chevron { color: var(--text-muted); transition: transform .2s; }

.tier-acc.open .tier-chevron { transform: rotate(180deg); }

.tier-acc.open .tier-acc-head {
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid var(--line);
}

.tier-acc-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 16px;
  padding: 18px 14px;
}

.bot-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: transform .12s;
}

.bot-chip:hover { transform: translateY(-3px); }

/* Bigger than the base .bot-face — this shelf has the room, and the whole
   point of clicking a tier open is to see the bot clearly, not squint. */
.bot-chip .bot-face { width: 78px; height: 78px; font-size: 42px; border-radius: 21px; }

.bot-chip small { font-size: 13px; font-weight: 800; color: var(--tier-color); }

.bot-chip.selected .bot-face {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--accent-green),
              0 0 18px color-mix(in srgb, var(--tier-color) 65%, transparent);
}

/* ----- The one big Play button, chess.com sized, parked at the bottom ----- */
#bots-select { min-height: 100vh; padding-bottom: 12px; }

.bots-playbar {
  position: sticky;
  bottom: 0;
  margin-top: auto;   /* pushes the button to the bottom of the screen */
  padding: 12px 0 8px;
  background: linear-gradient(transparent, var(--bg-main) 40%);
}

.bot-play-big {
  width: 100%;
  font-size: 20px;
  padding: 17px;
  border-radius: 12px;
}

.bot-play-big:disabled { opacity: .55; cursor: not-allowed; }

/* ----- Match arena ----- */
.match-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
}

.match-player { display: flex; align-items: center; gap: 10px; }

.match-avatar {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  background: linear-gradient(180deg, #343230, #232120);
  border: 2px solid var(--line);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08), 0 3px 0 rgba(0, 0, 0, .35);
}

.match-meta { display: flex; flex-direction: column; line-height: 1.25; }
.match-meta b { font-size: 14.5px; }
.match-meta small { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.match-meta-right { text-align: right; }

.match-score { display: flex; align-items: center; gap: 12px; }

.score-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.score-side b { font-size: 30px; font-weight: 900; line-height: 1; }
.score-sep { font-size: 22px; color: var(--text-muted); font-weight: 800; }

.score-pips { display: flex; gap: 3px; }

.score-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-inset);
  border: 1px solid var(--line);
}

.score-pip.filled-bot { background: #F97316; border-color: #F97316; }
.score-pip.filled-you { background: var(--accent-green); border-color: var(--accent-green); }

/* ----- The bot's thinking bar ----- */
.bot-think-track {
  height: 16px;
  border-radius: 999px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bot-think-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #F97316, #fbbf24);
  box-shadow: 0 0 12px rgba(249, 115, 22, .6);
  transition: width 0s linear; /* JS sets the real duration per round */
}

.bot-think-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.4em;
}

.match-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 0 4px;
}

.match-footer { display: flex; justify-content: center; }

/* The bot claimed the correct card — orange, not the player's green */
.option-card.bot-took {
  border-color: #F97316;
  background: rgba(249, 115, 22, .16);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .3);
}

/* ----- End-of-match overlay ----- */
.match-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 9, 8, .72);
  backdrop-filter: blur(3px);
  border-radius: 14px;
}

.match-overlay-card {
  position: relative;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 48px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  overflow: hidden;
}

.match-result-word {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 10px;
}

.match-result-word.result-win {
  background: linear-gradient(92deg, var(--accent-green-hover), var(--neon-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(129, 182, 76, .5));
}

.match-result-word.result-loss { color: var(--text-muted); }

.match-result-detail { color: var(--text-muted); max-width: 40ch; margin: 0 auto; }

.match-overlay-actions { justify-content: center; margin-top: 20px; }

