/* =========================
   SOLID GAME: TIC TAC TOE
========================= */

.ttt-game {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: "Fredoka", Arial, sans-serif;
  color: #000;
  overflow: hidden;
}

.ttt-score-race {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ttt-team-card {
  border: 7px solid #000;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 7px 7px 0 rgba(0,0,0,0.25);
}

.red-team {
  background: #ffd0d0;
}

.blue-team {
  background: #cfe5ff;
}

.ttt-team-top {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.ttt-team-badge {
  width: 58px;
  height: 58px;
  border: 5px solid #000;
  border-radius: 16px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
}

.ttt-team-top h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.ttt-team-top p {
  margin: 3px 0 0;
  font-size: 15px;
  font-weight: 800;
}

.ttt-team-top strong {
  background: #fff;
  border: 5px solid #000;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 22px;
  font-weight: 900;
}

.ttt-progress-track {
  height: 38px;
  position: relative;
  background: #fff;
  border: 5px solid #000;
  border-radius: 999px;
  overflow: hidden;
}

.ttt-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  transition: width 0.35s ease;
}

.red-fill {
  background: repeating-linear-gradient(45deg, #ff4545 0 12px, #ff8383 12px 24px);
}

.blue-fill {
  background: repeating-linear-gradient(45deg, #368bff 0 12px, #83bdff 12px 24px);
}

.ttt-runner {
  position: absolute;
  top: 50%;
  left: -14px;
  transform: translateY(-50%);
  z-index: 4;
  font-size: 24px;
  transition: left 0.35s ease;
  filter: drop-shadow(2px 2px 0 #000);
}

.ttt-goal {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  font-size: 24px;
}

.ttt-main-area {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  overflow: hidden;
}

.ttt-board-panel,
.ttt-side-panel > * {
  border: 7px solid #000;
  border-radius: 24px;
  box-shadow: 7px 7px 0 rgba(0,0,0,0.25);
}

.ttt-board-panel {
  min-width: 0;
  min-height: 0;
  background: #fff1a8;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ttt-round-strip {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.ttt-round-strip span {
  background: #fff;
  border: 5px solid #000;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 20px;
  font-weight: 900;
}

.ttt-board {
  flex: 1 1 auto;
  min-height: 0;
  width: min(560px, 100%);
  aspect-ratio: 1 / 1;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ttt-cell {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #ffffff;
  border: 7px solid #000;
  border-radius: 22px;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.25);
  font-size: clamp(42px, 8vw, 92px);
  font-weight: 900;
  font-family: "Fredoka", Arial, sans-serif;
  display: grid;
  place-items: center;
}

.ttt-cell:not(:disabled):hover {
  background: #d3ff00;
  transform: translateY(-3px) scale(1.02);
}

.ttt-cell.red-mark {
  background: #ff6767;
  color: #fff;
  text-shadow: 4px 4px 0 #000;
}

.ttt-cell.blue-mark {
  background: #4f9cff;
  color: #fff;
  text-shadow: 4px 4px 0 #000;
}

.ttt-cell.winner-cell {
  outline: 7px solid #d3ff00;
  animation: tttWinnerPulse 0.6s ease infinite alternate;
}

@keyframes tttWinnerPulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.04) rotate(-1deg);
  }
}

.ttt-side-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.ttt-status-card,
.ttt-rule-card {
  background: #bff1ea;
  padding: 16px;
}

.ttt-current-icon {
  height: 110px;
  background: #fff;
  border: 6px solid #000;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 58px;
  margin-bottom: 12px;
}

.ttt-current-icon.red-current {
  background: #ffd0d0;
}

.ttt-current-icon.blue-current {
  background: #cfe5ff;
}

.ttt-status-card h2,
.ttt-rule-card h3 {
  margin: 0 0 10px;
  font-size: 25px;
  font-weight: 900;
}

.ttt-status-card p,
.ttt-rule-card p {
  margin: 7px 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.ttt-next-round-btn,
.ttt-reset-btn {
  width: 100%;
  font-size: 19px;
  font-weight: 900;
  font-family: "Fredoka", Arial, sans-serif;
}

.ttt-next-round-btn {
  background: #23d8ff;
}

.ttt-reset-btn {
  background: #ff9b42;
  margin-top: auto;
}

@media (max-width: 920px) {
  .ttt-score-race,
  .ttt-main-area {
    grid-template-columns: 1fr;
  }

  .ttt-side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ttt-next-round-btn,
  .ttt-reset-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .ttt-team-top {
    grid-template-columns: 46px 1fr;
  }

  .ttt-team-top strong {
    grid-column: 1 / -1;
    text-align: center;
  }

  .ttt-round-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .ttt-round-strip span {
    text-align: center;
    font-size: 16px;
  }

  .ttt-side-panel {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   FIX TIC TAC TOE CELL SIZE
========================================================= */

.ttt-board {
  width: min(560px, 100%) !important;
  height: min(560px, 100%) !important;
  max-height: calc(100vh - 360px) !important;

  aspect-ratio: 1 / 1 !important;

  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  grid-template-rows: repeat(3, 1fr) !important;

  gap: 12px !important;
  margin: auto !important;
}

.ttt-cell {
  width: 100% !important;
  height: 100% !important;

  min-width: 0 !important;
  min-height: 0 !important;

  padding: 0 !important;
  margin: 0 !important;

  box-sizing: border-box !important;

  display: grid !important;
  place-items: center !important;

  line-height: 1 !important;
  aspect-ratio: 1 / 1 !important;

  font-size: clamp(44px, 7vw, 88px) !important;
}

.ttt-cell.red-mark,
.ttt-cell.blue-mark {
  padding: 0 !important;
  border-width: 7px !important;
  transform: none;
}

.ttt-cell:disabled {
  opacity: 1 !important;
}