.game-screen {
  min-height: calc(100dvh - 4rem);
  padding-top: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
}

.game-container {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  align-items: center;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.board-panel {
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.game-status {
  display: flex;
  align-items: center;
  gap: 1rem;

  font-size: 1.25rem;
  font-weight: 600;

  color: var(--color-text);
}

.game-action-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.player-panel {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 2px var(--spacing-xs);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.player-panel.is-active {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgb(56 189 248 / 18%);
}

.player-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.player-symbol img {
  width: 100%;
  height: 100%;
}

.player-info {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-size: 1rem;
  font-weight: 600;
}

dialog.starter-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text);
}

dialog.starter-dialog[open] {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
}

dialog.starter-dialog::backdrop {
  background: rgba(2, 6, 23, 0.7);
}

.starter-card {
  position: relative;
  width: 180px;
  height: 180px;
  transform-style: preserve-3d;
}

.starter-text {
  font-size: 1.25rem;
  font-weight: 600;
}

.starter-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
  background: var(--color-surface);
}

.starter-face img {
  height: 6rem;
  width: 6rem;
}

.starter-front {
  transform: rotateY(0deg);
}

.starter-back {
  transform: rotateY(180deg);
}

.starter-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.starter-card.show-back {
  transform: rotateY(180deg);
}

.starter-card.is-spinning {
  animation: starter-spin 2.5s ease-out forwards;
}

@keyframes starter-spin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(1440deg);
  }
}

/* ===== WIN LINE ===== */

.win-line {
  position: absolute;
  background-color: white;
  border-radius: 999px;
  z-index: 10;
}

/* HORIZONTAL */
.win-line.win-row-top {
  top: 15%;
  left: 10%;
  width: 80%;
  height: 6px;
}

.win-line.win-row-middle {
  top: 50%;
  left: 10%;
  width: 80%;
  height: 6px;
}

.win-line.win-row-bottom {
  top: 83.33%;
  left: 10%;
  width: 80%;
  height: 6px;
}

.win-line.win-row-top,
.win-line.win-row-middle,
.win-line.win-row-bottom {
  animation:
    draw-line-horizontal 1s ease forwards;
}

/* VERTICAL */
.win-line.win-col-left {
  top: 10%;
  left: 15%;
  width: 6px;
  height: 80%;
}

.win-line.win-col-middle {
  top: 10%;
  left: 50%;
  width: 6px;
  height: 80%;
}

.win-line.win-col-right {
  top: 10%;
  left: 83.33%;
  width: 6px;
  height: 80%;
}

.win-line.win-col-left,
.win-line.win-col-middle,
.win-line.win-col-right {
  animation:
    draw-line-vertical 1s ease forwards;
}

/* DIAGONAL */
.win-line.win-diagonal-main {
  top: 50%;
  left: 50%;
  width: 115%;
  height: 6px;
  transform:
    translate(-50%, -50%) rotate(45deg);
  animation:
    draw-line-diagonal 1s ease forwards;
}

.win-line.win-diagonal-secondary {
  top: 50%;
  left: 50%;
  width: 115%;
  height: 6px;
  transform:
    translate(-50%, -50%) rotate(-45deg);
  animation:
    draw-line-diagonal-secondary 1s ease forwards;
}

@keyframes draw-line-horizontal {

  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes draw-line-vertical {

  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

@keyframes draw-line-diagonal {

  from {
    opacity: 0;
    transform:
      translate(-50%, -50%) rotate(45deg) scaleX(0);
  }

  to {
    opacity: 1;
    transform:
      translate(-50%, -50%) rotate(45deg) scaleX(1);
  }
}

@keyframes draw-line-diagonal-secondary {

  from {
    opacity: 0;
    transform:
      translate(-50%, -50%) rotate(-45deg) scaleX(0);
  }

  to {
    opacity: 1;
    transform:
      translate(-50%, -50%) rotate(-45deg) scaleX(1);
  }
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  .starter-card.is-spinning {
    animation: none;
  }

  .starter-card,
  .starter-card.show-back {
    transition: none;
  }

  .win-line {
    animation: none;
    transform: none;
    opacity: 1;
  }

  .win-line.win-diagonal-main {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .win-line.win-diagonal-secondary {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .player-panel {
    transition: none;
  }
}

/* ===== RESPONSIVE ===== */

@media (min-width: 900px) {

  .game-container {
    grid-template-columns: 2fr 1fr;
  }

  .game-panel {
    padding: 0 clamp(1rem, 3vw, 4rem);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    height: 100%;
  }

}
