/* Games hub — admin Dev tables (game.php / game.html)
   Author: Dave Greenlaw */

.bb-games-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg, var(--surface, #f5f6f8));
  color: var(--text, #1a1a1a);
}

body.bb-games-embed .index-header,
body.bb-games-embed .index-footer {
  display: none !important;
}

body.bb-games-embed {
  min-height: 0;
  height: 100%;
}

.bb-games-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  padding: 0;
}

/* Hub list is taller than the viewport (War sits on a later row). .app-shell
   clips with overflow:hidden — allow the picker to scroll; tables still fill. */
body.bb-games-body:not(.is-table-open) .bb-games-shell {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bb-games-hub {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 0 32px;
}

.bb-games-hub[hidden],
.bb-games-stage[hidden],
.bb-games-table[hidden] {
  display: none !important;
}

.bb-games-hero {
  --bb-games-hero-h: min(42vh, 320px);
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  width: 100%;
  min-height: var(--bb-games-hero-h);
  overflow: hidden;
  /* Night felt + gold rail — wings fill the screen; the PNG stays centered. */
  background-color: #07090c;
  background-image:
    linear-gradient(180deg, rgba(212, 175, 55, 0.22) 0, rgba(212, 175, 55, 0.06) 10px, transparent 28px),
    linear-gradient(0deg, rgba(212, 175, 55, 0.16) 0, rgba(212, 175, 55, 0.04) 8px, transparent 22px),
    radial-gradient(ellipse 42% 90% at 50% 50%, rgba(22, 48, 36, 0.35) 0%, transparent 72%),
    repeating-linear-gradient(60deg, rgba(212, 175, 55, 0.07) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(-60deg, rgba(34, 197, 94, 0.05) 0 1px, transparent 1px 36px),
    radial-gradient(circle at 18% 38%, rgba(251, 191, 36, 0.14), transparent 22%),
    radial-gradient(circle at 82% 62%, rgba(56, 189, 248, 0.1), transparent 24%),
    radial-gradient(ellipse at 50% 120%, #12261c 0%, #07090c 55%);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, #d4af37 28%, transparent);
}

.bb-games-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><text x='18' y='44' font-size='26' fill='%23d4af37'>♠</text><text x='98' y='48' font-size='22' fill='%23e8c4c4'>♥</text><text x='42' y='112' font-size='22' fill='%23d4af37'>♣</text><text x='112' y='118' font-size='26' fill='%2393c5fd'>♦</text></svg>");
  background-size: 160px 160px;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 26%, transparent 74%, #000 100%);
  mask-image: linear-gradient(90deg, #000 0%, transparent 26%, transparent 74%, #000 100%);
}

.bb-games-hero img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  max-width: 100%;
  height: var(--bb-games-hero-h);
  object-fit: contain;
  object-position: center top;
}

.bb-games-intro {
  padding: 0 20px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.bb-games-intro h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  color: var(--text, #1a1a1a);
}

.bb-games-intro p {
  margin: 0;
  color: var(--text-muted, #4b5563);
  line-height: 1.5;
}

.bb-games-intro__back {
  margin-top: 10px !important;
}

.bb-games-intro__back a {
  color: var(--accent, #2563eb);
  font-weight: 600;
}

.bb-games-nav-dev {
  display: contents;
}

.bb-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  padding: 4px 20px 0;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.bb-games-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 148px;
  padding: 18px 12px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  text-align: center;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text, #000) 6%, transparent);
}

.bb-games-card__play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: center;
  font: inherit;
}

.bb-games-card:hover {
  border-color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--surface, #fff));
}

.bb-games-card__play:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
  border-radius: 8px;
}

.bb-games-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  color: var(--text, #1a1a1a);
}

.bb-games-card__name {
  font-size: 1.05rem;
  font-weight: 700;
}

.bb-games-card__hint {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}

.bb-games-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bb-games-stage__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.28));
  background: var(--surface-muted, var(--surface, #eef0f4));
  flex-shrink: 0;
}

.bb-games-stage__bar .pill-btn {
  min-height: 40px;
}

.bb-games-stage__dev {
  margin-left: auto;
  color: var(--accent, #2563eb);
  font-weight: 600;
  font-size: 0.92rem;
}

.bb-games-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bb-games-table .crib-app {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.bb-games-body.is-table-open .index-footer {
  display: none;
}

/* In-table Dev tools toggled the old Dev tab bar; hub uses All games instead. */
.bb-games-body [data-crib-dev-tools],
.bb-games-body [data-eu-dev-tools],
.bb-games-body [data-fk-dev-tools],
.bb-games-body [data-yz-dev-tools],
.bb-games-body [data-wr-dev-tools],
.bb-games-body [data-pk-dev-tools] {
  display: none !important;
}

html[data-a11y-view="contrast"] .bb-games-hero::before {
  opacity: 0.12;
}

html[data-a11y-view="comfort"] .bb-games-hero {
  --bb-games-hero-h: min(46vh, 360px);
}

@media (max-width: 720px) {
  .bb-games-hero {
    --bb-games-hero-h: min(28vh, 180px);
  }

  .bb-games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 12px 40px;
  }

  .bb-games-intro {
    padding: 0 12px;
  }

  .bb-games-intro__back,
  .bb-games-stage__dev,
  .bb-games-nav-dev {
    display: none !important;
  }

  .bb-games-card {
    min-height: 132px;
    padding: 14px 8px 8px;
  }
}
