/* FCC Family Games - Phase 6C replay library */

.fcc-replay-library {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fcc-replay-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 150px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.88), rgba(232,244,255,0.72)),
    linear-gradient(90deg, rgba(22,163,74,0.16), rgba(14,165,233,0.14));
  backdrop-filter: blur(20px);
}

.fcc-replay-hero h2 {
  margin: 4px 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.fcc-replay-hero p,
.fcc-replay-viewer__head p {
  margin: 0;
  color: rgba(60,60,67,0.72);
}

.fcc-replay-eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #147d64;
}

.fcc-replay-filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.fcc-replay-filterbar select {
  min-height: 44px;
  border: 1px solid rgba(60,60,67,0.14);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,0.78);
}

.fcc-replay-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fcc-replay-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fcc-replay-section__head h3,
.fcc-replay-viewer__head h3 {
  margin: 0;
  letter-spacing: 0;
}

.fcc-replay-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 320px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}

.fcc-replay-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.fcc-replay-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 230px;
  padding: 14px;
  border: 1px solid rgba(60,60,67,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 10px 30px rgba(15,23,42,0.08);
  backdrop-filter: blur(16px);
  scroll-snap-align: start;
}

.fcc-replay-card--compact {
  min-height: 220px;
}

.fcc-replay-card__top,
.fcc-replay-card__foot,
.fcc-replay-meta,
.fcc-replay-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fcc-replay-card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(20,125,100,0.12);
  font-size: 22px;
}

.fcc-replay-card h4 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.fcc-replay-card__players,
.fcc-replay-card__result {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcc-replay-card__result {
  font-weight: 700;
}

.fcc-replay-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.fcc-replay-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(14,165,233,0.12);
  color: #075985;
  font-size: 12px;
  font-weight: 700;
}

.fcc-replay-card__foot {
  margin-top: auto;
  color: rgba(60,60,67,0.72);
  font-size: 13px;
}

.fcc-replay-card__actions {
  display: inline-flex;
  gap: 6px;
}

.fcc-replay-star {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(60,60,67,0.12);
  border-radius: 50%;
  background: rgba(255,255,255,0.74);
  color: rgba(60,60,67,0.62);
  font-size: 20px;
  cursor: pointer;
}

.fcc-replay-star.is-on {
  color: #b7791f;
  background: rgba(254,243,199,0.92);
}

.fcc-replay-empty {
  padding: 16px;
  border: 1px dashed rgba(60,60,67,0.18);
  border-radius: 8px;
  color: rgba(60,60,67,0.72);
  background: rgba(255,255,255,0.42);
}

.fcc-replay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10,15,25,0.38);
  backdrop-filter: blur(18px);
}

.fcc-replay-viewer {
  width: min(920px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 8px;
  background: rgba(248,250,252,0.9);
  box-shadow: 0 24px 80px rgba(2,6,23,0.28);
}

.fcc-replay-viewer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.fcc-replay-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(60,60,67,0.14);
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  cursor: pointer;
}

.fcc-replay-board-wrap {
  display: grid;
  place-items: center;
  min-height: 260px;
}

.fcc-replay-ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 88px);
  gap: 8px;
}

.fcc-replay-ttt-cell,
.fcc-replay-grid-cell,
.fcc-replay-c4-cell {
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
}

.fcc-replay-ttt-cell {
  width: 88px;
  height: 88px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(60,60,67,0.14);
  font-size: 36px;
}

.fcc-replay-c4-board {
  display: grid;
  grid-template-columns: repeat(7, 42px);
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #0f766e;
}

.fcc-replay-c4-cell {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.86);
}

.fcc-replay-c4-cell span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.fcc-replay-c4-cell .is-red { background: #dc2626; }
.fcc-replay-c4-cell .is-yellow { background: #facc15; }

.fcc-replay-grid-board {
  display: grid;
  grid-template-columns: repeat(var(--fcc-replay-grid, 8), minmax(34px, 56px));
  border: 1px solid rgba(60,60,67,0.18);
}

.fcc-replay-grid-cell {
  aspect-ratio: 1;
  border-radius: 0;
  font-size: 18px;
}

.fcc-replay-grid-cell.is-light { background: #f8fafc; }
.fcc-replay-grid-cell.is-dark { background: #94a3b8; }

.fcc-replay-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fcc-replay-control-row {
  justify-content: center;
  flex-wrap: wrap;
}

.fcc-replay-slider {
  width: 100%;
}

.fcc-replay-speeds {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fcc-replay-speed {
  min-width: 44px;
  min-height: 34px;
  border: 1px solid rgba(60,60,67,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
}

.fcc-replay-speed.is-active {
  background: #147d64;
  color: #fff;
}

.fcc-replay-error,
.fcc-replay-loading {
  padding: 24px;
  text-align: center;
}

.fcc-replay-state {
  max-width: 100%;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
}

@media (max-width: 700px) {
  .fcc-replay-backdrop {
    padding: 0;
    align-items: stretch;
  }

  .fcc-replay-viewer {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .fcc-replay-hero,
  .fcc-replay-card__foot,
  .fcc-replay-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .fcc-replay-history-grid {
    grid-template-columns: 1fr;
  }

  .fcc-replay-ttt-board {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    width: min(100%, 280px);
  }

  .fcc-replay-ttt-cell {
    width: auto;
    height: auto;
    aspect-ratio: 1;
  }
}

@media (prefers-color-scheme: dark) {
  .fcc-replay-hero,
  .fcc-replay-card,
  .fcc-replay-filterbar select,
  .fcc-replay-viewer {
    background: rgba(31,41,55,0.86);
    color: #f8fafc;
    border-color: rgba(255,255,255,0.10);
  }

  .fcc-replay-hero p,
  .fcc-replay-viewer__head p,
  .fcc-replay-card__foot,
  .fcc-replay-empty {
    color: rgba(226,232,240,0.72);
  }
}
