:root {
  color-scheme: dark;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes winner-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.3);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(250, 204, 21, 0);
  }
}

@keyframes winner-glow {
  0%,
  100% {
    text-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.65);
  }
}

main {
  animation: fade-in-up 0.32s ease-out;
}

.glass {
  backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.55);
  transition: transform 160ms ease, border-color 180ms ease, background-color 180ms ease;
}

.glass:hover {
  transform: translateY(-2px);
}

a,
button,
input,
select {
  transition: all 150ms ease;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

button:active,
a:active {
  transform: translateY(0);
}

#toast-root > div {
  animation: toast-in 180ms ease-out;
}

#toast-root > div.toast-leave {
  animation: toast-out 180ms ease-in forwards;
}

.grid-cell {
  width: 2.2rem;
  height: 2.2rem;
}

.battleship-grid {
  display: grid;
  gap: 4px;
  max-width: 560px;
}

.battleship-grid-10 {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.battleship-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.4rem;
  border: 1px solid rgba(100, 116, 139, 0.6);
  transition: transform 130ms ease, background-color 130ms ease, border-color 130ms ease;
}

.battleship-cell-water,
.battleship-cell-unknown {
  background: rgba(15, 23, 42, 0.65);
}

.battleship-cell-ship {
  background: rgba(34, 197, 94, 0.35);
}

.battleship-cell-ship-hit,
.battleship-cell-hit {
  background: rgba(239, 68, 68, 0.6);
}

.battleship-cell-miss,
.battleship-cell-incoming-miss {
  background: rgba(148, 163, 184, 0.35);
}

.battleship-cell-unknown:hover {
  transform: scale(1.04);
  border-color: rgba(129, 140, 248, 0.9);
}

.ship-chip {
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.ship-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.7);
}

.ship-selected {
  outline: 2px solid rgba(99, 102, 241, 0.9);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.winner-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(250, 204, 21, 0.45);
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.18), rgba(15, 23, 42, 0.2));
  animation: winner-pulse 1.8s ease-in-out infinite;
}

.winner-label {
  color: rgba(254, 240, 138, 0.95);
  font-weight: 600;
  font-size: 0.86rem;
}

.winner-name {
  color: rgba(255, 255, 255, 0.96);
  font-weight: 700;
  animation: winner-glow 1.8s ease-in-out infinite;
}

.winner-you {
  color: rgba(196, 181, 253, 0.95);
  font-size: 0.84rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.mau-hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.7rem;
}

.mau-card-form {
  margin: 0;
}

.playing-card {
  position: relative;
  width: 100%;
  min-height: 126px;
  border-radius: 0.7rem;
  border: 1px solid rgba(15, 23, 42, 0.5);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
  padding: 0.5rem 0.35rem;
}

.playing-card .card-rank {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}

.playing-card .card-suit {
  font-size: 1.7rem;
  line-height: 1.1;
}

.playing-card::before,
.playing-card::after {
  position: absolute;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.playing-card::before {
  content: attr(title);
  top: 0.45rem;
  left: 0.45rem;
}

.playing-card::after {
  content: attr(title);
  bottom: 0.45rem;
  right: 0.45rem;
  transform: rotate(180deg);
}

.card-red {
  color: #b91c1c;
}

.card-black {
  color: #111827;
}

.card-large {
  max-width: 110px;
}

.card-clickable {
  transition: transform 150ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.card-clickable.card-playable:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.3);
  border-color: rgba(99, 102, 241, 0.55);
}

.card-clickable.card-not-playable {
  opacity: 0.55;
}

.user-menu-dropdown {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 200ms ease;
  transform-origin: top right;
}

.user-menu.open .user-menu-dropdown,
.user-menu:hover .user-menu-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.user-menu-item {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 0.45rem;
  color: rgb(226 232 240);
  font-size: 0.9rem;
}

.user-menu-item:hover {
  background: rgba(51, 65, 85, 0.55);
  color: rgb(255 255 255);
}

.user-menu-item-logout {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: rgb(252 165 165);
}

.user-menu-icon {
  width: 0.95rem;
  height: 0.95rem;
  object-fit: contain;
}

.user-menu-item-logout:hover {
  background: rgba(127, 29, 29, 0.38);
  color: rgb(254 202 202);
}
