/* ========================================
   AI Experiments (/ai-games)

   Lifted out of a ~990-line <style> block in ai_battles.html. The page now
   borrows the landing page's shell wholesale - body.landing-page in
   styles.css already supplies the #02050c ground, the glass header and the
   dark nav buttons - so what lives here is only the experiment grid.

   Colour is a hue slot per card via data-accent, matching the data-accent
   convention the LearnAI deck already uses. Structure and artwork stay in
   class modifiers, so the two concerns never tangle.
   ======================================== */

.ai-games-page {
  --games-ink: #f5f9ff;
  --games-muted: rgba(213, 229, 244, 0.72);
  --games-dim: rgba(198, 218, 240, 0.56);
  --games-line: rgba(111, 184, 255, 0.16);
  --games-surface: rgba(5, 16, 34, 0.5);
  --games-raise: rgba(9, 26, 52, 0.72);
}

/* Hue slots. Every value is drawn from the landing page's own palette so the
   two pages read as one product rather than as neighbours. */
.ai-games-page [data-accent="ocean"] { --feature-accent: #3aa8ff; }
.ai-games-page [data-accent="violet"] { --feature-accent: #a68cff; }
.ai-games-page [data-accent="teal"] { --feature-accent: #4ee4d4; }
.ai-games-page [data-accent="amber"] { --feature-accent: #f0b76a; }
.ai-games-page [data-accent="ember"] { --feature-accent: #ff9152; }
.ai-games-page [data-accent="gold"] { --feature-accent: #f5c86a; }

/* ---------- page frame ---------- */
/* Above the starfield: body.landing-page puts #ambient-bg on z-index 2, which
   is right for the landing's near-transparent panels but sprays dust across
   these more solid cards. */
.battles-main {
  position: relative;
  z-index: 3;
  max-width: 1180px;
  margin: 0 auto;
  padding: 148px 24px 96px;
}

.battles-title {
  max-width: 720px;
  margin-bottom: 52px;
}

.battles-title h1 {
  margin-bottom: 16px;
  color: var(--games-ink);
  font-size: clamp(38px, 5.4vw, 62px);
  font-weight: 850;
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-shadow: none;
}

.battles-title p {
  max-width: 620px;
  color: var(--games-muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.6;
}

.battles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: stretch;
}

/* ---------- the experiment card ---------- */
.battle-card.game-feature {
  --feature-accent: #3aa8ff;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  height: 400px;
  min-height: 400px;
  overflow: hidden;
  border: 1px solid var(--games-line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--feature-accent) 7%, transparent), transparent 62%),
    var(--games-surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

/* An open dropdown needs the room a fixed height would deny it. */
.battle-card.game-feature:has(.battle-dropdown:not(.hidden)) {
  height: auto;
}

.battle-card.game-feature:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--feature-accent) 42%, transparent);
  box-shadow:
    0 36px 96px rgba(0, 0, 0, 0.56),
    inset 0 -3px color-mix(in srgb, var(--feature-accent) 60%, transparent);
}

.game-feature--reverse .game-feature__media { order: 2; }
.game-feature--reverse .game-feature__content { order: 1; }

/* ---------- artwork half ---------- */
.game-feature__media {
  position: relative;
  display: block;
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #061020;
}

/* Sink the artwork's edge into the card instead of ending on a hard seam. */
.game-feature__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 58%, rgba(2, 5, 12, 0.72));
  pointer-events: none;
}

.game-feature--reverse .game-feature__media::after {
  background: linear-gradient(270deg, transparent 58%, rgba(2, 5, 12, 0.72));
}

.game-feature__media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.game-feature:hover .game-feature__media img { transform: scale(1.03); }

/* The boxing-gloves art is a product shot on a white ground. Bled to the card
   edge it punches a hole in the page, so it is mounted like a framed print
   instead - deliberate white, with margin around it, rather than a leak. */
.game-feature--experiments .game-feature__media {
  display: grid;
  place-items: center;
  padding: 30px;
  background: #061020;
}

.game-feature--experiments .game-feature__media::after { display: none; }

.game-feature--experiments .game-feature__media img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

.game-feature--human .game-feature__media img { object-position: center; }
.game-feature--gladiator .game-feature__media img { object-position: center 45%; }
.game-feature--music .game-feature__media img { object-position: center 37%; }

/* The model matrix is a screenshot of four dark panels - cropping it would cut
   a model out of the comparison, so it is contained rather than covered. */
.model-matrix-preview { background: #020817; }
.model-matrix-preview::after { display: none; }
.model-matrix-preview img {
  object-fit: contain;
  object-position: center;
}

.battle-monkeys-preview {
  background:
    linear-gradient(90deg, rgba(2, 5, 12, 0.2), rgba(2, 5, 12, 0.55)),
    url('https://battle-monkeys-reborn.diegocabezas01.chatgpt.site/assets/arena-background.webp') center / cover no-repeat;
}

.game-feature--battle-monkeys .battle-monkeys-preview img {
  position: absolute;
  right: -7%;
  bottom: -10%;
  z-index: 1;
  width: 92%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.55));
}

/* ---------- copy half ---------- */
.game-feature__content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
  padding: 40px 44px;
}

.game-feature__kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--feature-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* The short rule before the kicker is the landing page's own eyebrow tell. */
.game-feature__kicker::before {
  content: '';
  width: 24px;
  height: 2px;
  background: currentColor;
}

.game-feature h2,
.battle-card--gladiator.game-feature h2 {
  margin: 0;
  color: var(--games-ink);
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 850;
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.game-feature p,
.battle-card--gladiator.game-feature p {
  max-width: 500px;
  margin: 0;
  color: var(--games-muted);
  font-size: 16px;
  line-height: 1.65;
}

.game-feature p.game-feature__note {
  margin-top: -6px;
  color: var(--feature-accent);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: 0.015em;
}

.game-feature__badge {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid color-mix(in srgb, var(--feature-accent) 34%, transparent);
  border-radius: 999px;
  background: rgba(2, 5, 12, 0.76);
  color: var(--games-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.game-feature__badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--feature-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--feature-accent) 20%, transparent);
}

/* ---------- actions ---------- */
.game-feature__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.battle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid color-mix(in srgb, var(--feature-accent) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--feature-accent) 14%, rgba(4, 14, 30, 0.7));
  color: var(--games-ink);
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.battle-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--feature-accent) 70%, transparent);
  background: color-mix(in srgb, var(--feature-accent) 24%, rgba(4, 14, 30, 0.78));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--feature-accent) 24%, transparent);
}

.battle-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--feature-accent) 55%, transparent);
  outline-offset: 3px;
}

.battle-btn.battle-btn--secondary {
  border-color: var(--games-line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--games-muted);
}

.battle-btn.battle-btn--secondary:hover {
  border-color: color-mix(in srgb, var(--feature-accent) 50%, transparent);
  background: rgba(255, 255, 255, 0.08);
  color: var(--games-ink);
}

.battle-code-link {
  white-space: nowrap;
}

.battle-code-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* The gladiator card is one big link; the overlay makes the whole card its
   hit area without nesting an anchor around interactive content. */
.game-feature--gladiator { position: relative; }

.game-feature--gladiator .gladiator-launch::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}

.game-feature--gladiator .gladiator-launch:focus-visible {
  outline: 3px solid var(--feature-accent);
  outline-offset: 4px;
}

/* ---------- dropdowns ---------- */
.battle-dropdown {
  width: 100%;
  margin-top: 4px;
  padding: 15px;
  border: 1px solid var(--games-line);
  border-radius: 14px;
  background: var(--games-raise);
}

.battle-dropdown.hidden { display: none; }

.battle-dropdown label {
  display: block;
  margin-bottom: 9px;
  color: var(--games-ink);
  font-size: 14px;
  font-weight: 600;
}

.battle-dropdown select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--games-line);
  border-radius: 10px;
  background: rgba(2, 8, 20, 0.9);
  color: var(--games-ink);
  font-size: 14px;
}

.battle-dropdown select:focus {
  outline: none;
  border-color: var(--feature-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--feature-accent) 22%, transparent);
}

.dropdown-meta {
  margin-top: 10px;
  color: var(--games-dim);
  font-size: 13px;
  line-height: 1.5;
}

.battles-message {
  margin-top: 26px;
  min-height: 24px;
  color: var(--games-muted);
  font-size: 14px;
  font-weight: 500;
}

.battles-message.error { color: #ff8a9c; }

/* ---------- millionaire stage (self-contained artwork) ---------- */
.millionaire-preview {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 52%, rgba(111, 84, 238, 0.56), transparent 24%),
    radial-gradient(circle at 50% 50%, #25216a 0%, #0e0d32 48%, #070719 100%);
}

.millionaire-preview::after { display: none; }

.millionaire-preview__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(72%, 340px);
  aspect-ratio: 1;
  border: 1px solid rgba(247, 214, 124, 0.42);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(137, 105, 238, 0.32) 0deg 3deg, transparent 3deg 18deg),
    radial-gradient(circle, rgba(32, 25, 94, 0.94) 0 54%, rgba(10, 9, 38, 0.85) 55% 100%);
  box-shadow:
    0 0 0 12px rgba(116, 87, 222, 0.08),
    0 0 80px rgba(116, 87, 222, 0.38);
}

.millionaire-preview__stage::before,
.millionaire-preview__stage::after {
  content: '';
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(247, 214, 124, 0.38);
  transform: rotate(45deg);
}

.millionaire-preview__stage::after {
  inset: 21%;
  border-color: rgba(164, 140, 255, 0.5);
}

.millionaire-preview__copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}

.millionaire-preview__eyebrow {
  color: #d7cef9;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.millionaire-preview__amount {
  margin-top: 5px;
  color: #f4d47d;
  font-size: clamp(30px, 4vw, 50px);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: 0 4px 22px rgba(244, 212, 125, 0.28);
}

.millionaire-preview__answer {
  margin-top: 10px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(8, 7, 31, 0.64);
  color: #fff;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.1em;
}

.millionaire-preview__contestants {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- responsive ---------- */
@media (max-width: 850px) {
  .battles-main { padding: 128px 20px 72px; }
  .battles-title { margin-bottom: 34px; }

  .battle-card.game-feature {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  /* Artwork leads on a narrow screen, whichever side it sat on at desktop. */
  .game-feature--reverse .game-feature__media,
  .game-feature__media {
    order: 1;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .game-feature--reverse .game-feature__content,
  .game-feature__content { order: 2; padding: 28px; }

  .game-feature__media::after,
  .game-feature--reverse .game-feature__media::after {
    background: linear-gradient(0deg, rgba(2, 5, 12, 0.66), transparent 46%);
  }

  .game-feature__media img { min-height: 0; }
}

@media (max-width: 600px) {
  .battles-main { padding: 112px 14px 56px; }
  .battles-grid { gap: 14px; }
  .battle-card.game-feature { border-radius: 18px; }
  .game-feature__content { padding: 22px 18px 24px; }

  .game-feature h2,
  .battle-card--gladiator.game-feature h2 { font-size: 29px; }

  .game-feature p,
  .battle-card--gladiator.game-feature p { font-size: 14px; }

  .game-feature__actions { align-items: stretch; flex-direction: column; }

  .game-feature__actions .battle-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .battle-card.game-feature,
  .game-feature__media img,
  .battle-btn { transition: none; }

  .battle-card.game-feature:hover { transform: none; }
  .game-feature:hover .game-feature__media img { transform: none; }
}
