:root {
  --green: #1aff4c;
  --red: #ff3b3b;
  --bg: #050b08;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(26, 255, 76, 0.08), transparent 40%),
    var(--bg);
  color: white;
}

/* =========================
   TOAST
========================= */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(30px) scale(0.9);
  background: rgba(0, 0, 0, 0.95);
  color: var(--green);
  padding: 14px 20px;
  border: 1px solid var(--green);
  border-radius: 12px;
  opacity: 0;
  z-index: 9999;

  /* animation */
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow: 0 0 25px rgba(26, 255, 76, 0.2);
  backdrop-filter: blur(10px);
}

/* SHOW STATE */
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: toastPop 0.4s ease;
}

/* EXIT ANIMATION */
#toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(20px) scale(0.95);
}

/* POP EFFECT */
@keyframes toastPop {
  0% {
    transform: translateX(-50%) translateY(20px) scale(0.9);
  }
  60% {
    transform: translateX(-50%) translateY(-5px) scale(1.03);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* =========================
   TOPBAR
========================= */
.topbar {
  text-align: center;
  padding: 25px 20px 10px;
}

.topbar h1 {
  color: var(--green);
  font-size: 38px;
  margin-bottom: 5px;
}

.topbar p {
  opacity: 0.7;
}

/* =========================
   SUGGESTIONS
========================= */
.suggestions {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

.suggest-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.helper-text h2 {
  margin: 0;
  color: var(--green);
}

.helper-text p {
  opacity: 0.7;
  margin-top: 6px;
  font-size: 14px;
}

/* =========================
   SEARCH
========================= */
.suggest-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrapper {
  position: relative;
}

.search-box {
  width: 420px;
  position: relative;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--green);
}

.search-box input {
  width: 100%;
  padding: 14px 14px 14px 40px;
  border-radius: 12px;
  border: 1px solid rgba(26, 255, 76, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  box-sizing: border-box;
  font-size: 14px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--green);
  box-shadow: 0 0 15px rgba(26, 255, 76, 0.2);
}

/* =========================
   RANDOM BUTTON
========================= */
.random-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(26, 255, 76, 0.5);
  background: rgba(255, 255, 255, 0.03);
  color: var(--green);
  cursor: pointer;
  transition: 0.3s;
  font-size: 16px;
}

.random-btn:hover {
  background: var(--green);
  color: black;
  transform: rotate(180deg);
}

/* =========================
   DROPDOWN
========================= */
.member-dropdown {
  position: absolute;
  width: 420px;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.96);
  border: 1px solid rgba(26, 255, 76, 0.3);
  border-radius: 14px;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
  z-index: 999;
  backdrop-filter: blur(10px);
}

.hidden {
  display: none;
}

.dropdown-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 14px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: 0.2s;
}

.dropdown-item:hover {
  background: rgba(26, 255, 76, 0.08);
}

.dropdown-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dropdown-left span {
  font-weight: 600;
}

.dropdown-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(26, 255, 76, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: var(--green);
  cursor: pointer;
  transition: 0.2s;
}

.icon-btn:hover {
  background: var(--green);
  color: black;
  transform: translateY(-2px);
}

.icon-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  filter: grayscale(1);
  pointer-events: none;
}

.taken-label {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: gray;
  text-align: center;
}

.random-card.taken {
  opacity: 0.5;
  filter: grayscale(1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  box-shadow: 0 0 15px rgba(26, 255, 76, 0.15);
}

.random-card.taken::after {
  content: "ALREADY SELECTED";
  position: absolute;
  top: 10px;
  right: 10px;

  font-size: 10px;
  padding: 4px 6px;

  background: rgba(0, 0, 0, 0.7);
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

/* =========================
   RANDOM CARDS
========================= */
.random-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 25px;
}

.random-card {
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.02));

  border: 1px solid rgba(26, 255, 76, 0.15);
  border-radius: 18px;
  padding: 18px;
  transition: 0.25s;
  position: relative;
  overflow: hidden;
}

.random-card:hover {
  transform: translateY(-5px);
  border-color: rgba(26, 255, 76, 0.5);
  box-shadow: 0 0 25px rgba(26, 255, 76, 0.15);
}

.random-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg,
      rgba(26, 255, 76, 0.05),
      transparent 40%);
  pointer-events: none;
}

.random-card .dropdown-left {
  margin-bottom: 14px;
}

.random-card .dropdown-left img {
  width: 55px !important;
  height: 55px !important;
  border: 2px solid var(--green);
}

.stats-mini {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.stats-mini div {
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.random-card .dropdown-actions {
  justify-content: center;
  justify-items: center;
  width: 100%;
}

/* =========================
   RESULT
========================= */
.result-banner {
  text-align: center;
  font-size: 34px;
  font-weight: bold;
  margin: 25px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 70px;
  overflow: hidden;
  position: relative;
}

.result-banner.win {
  color: var(--green);
  text-shadow: 0 0 20px var(--green);
}

.result-banner.lose {
  color: var(--green) !important;
  text-shadow: 0 0 20px var(--green) !important;
}

.result-banner i {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.result-banner.win i {
  margin-right: 10px;
  animation: trophyGlow 1.2s infinite ease-in-out;
}

@keyframes trophyGlow {
  0% {
    transform: scale(1);
    text-shadow: 0 0 5px var(--green);
  }

  50% {
    transform: scale(1.2);
    text-shadow:
      0 0 10px var(--green),
      0 0 25px var(--green);
  }

  100% {
    transform: scale(1);
    text-shadow: 0 0 5px var(--green);
  }
}

.result-banner.draw {
  color: #aaa;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  animation: drawPulse 2.2s ease-in-out infinite;
}

.result-banner.draw i {
  margin-right: 10px;
}

@keyframes drawPulse {
  0% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.5;
  }
}

/* =========================
   COMPARE
========================= */
.compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  padding: 30px;
  max-width: 1100px;
  margin: auto;
}

.compare-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(26, 255, 76, 0.2);
  border-radius: 18px;
  padding: 20px;
}

.vs {
  display: flex;
  align-items: center;
  font-size: 40px;
  color: var(--green);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-info img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--green);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.win {
  color: var(--green);
}

.lose {
  color: var(--red);
}

/* =========================
   VS + FIGHT BUTTON
========================= */
.vs-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.fight-btn {
  padding: 14px 26px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg,
      #1aff4c,
      #0cff88);

  color: black;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: 0.25s;
  box-shadow: 0 0 20px rgba(26, 255, 76, 0.35);
}

.fight-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 0 30px rgba(26, 255, 76, 0.6);
}

.fight-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =========================
   EMPTY PLAYER SLOT
========================= */
.empty-slot {
  height: 100%;
  min-height: 260px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  opacity: 0.45;
  text-align: center;
}

.empty-slot i {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--green);
}

/* =========================
   PLAYER SELECT PREVIEW
========================= */
.player-selected {
  animation: fadeUp 0.4s ease;
}

.player-selected .player-info {
  margin-bottom: 18px;
}

.player-preview-stats {
  display: grid;
  gap: 10px;
}

.player-preview-stats div {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 12px;
}

/* =========================
   STAT REVEAL
========================= */
.stat-row {
  opacity: 0;
  transform: translateY(10px);
  animation: revealStat 0.5s forwards;
}

@keyframes revealStat {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   CINEMATIC
========================= */
.cinematic {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cinematic:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.cinematic.hidden {
  display: none !important;
  pointer-events: none !important;
}

.vs-screen {
  display: flex;
  align-items: center;
  gap: 70px;
}

.vs-left,
.vs-right {
  text-align: center;
}

.vs-left img,
.vs-right img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid var(--green);
  box-shadow: 0 0 25px rgba(26, 255, 76, 0.4);
}

.vs-center {
  font-size: 90px;
  color: var(--green);
  text-shadow: 0 0 25px var(--green);
}

.ready-state {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ready-state i {
  font-size: 42px;
  color: var(--green);
  opacity: 0.7;

  animation: pulseReady 1.2s infinite;
}

@keyframes pulseReady {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}

/* =========================
   SKELETON LOADING
========================= */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: 200px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 25%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0.05) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: 10px;
}

/* =========================
   RANDOM CARD SKELETON
========================= */
.card-skeleton {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(26, 255, 76, 0.1);
}

.skel-avatar {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.skel-line {
  height: 12px;
  margin: 8px 0;
  border-radius: 6px;
}

.skel-line.short {
  width: 60%;
}

/* =========================
   COMPARE SKELETON
========================= */
.compare-skeleton {
  padding: 20px;
  border-radius: 18px;
}

.skel-big-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.skel-stat {
  height: 14px;
  margin: 10px 0;
  border-radius: 6px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {

  .random-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .compare {
    grid-template-columns: 1fr;
  }

  .vs {
    justify-content: center;
  }

  .search-box,
  .member-dropdown {
    width: 100%;
  }

  .suggest-controls {
    width: 100%;
  }

  .search-wrapper {
    flex: 1;
  }
}

@media (max-width: 600px) {

  .random-grid {
    grid-template-columns: 1fr;
  }

  .vs-screen {
    flex-direction: column;
    gap: 20px;
  }

  .vs-center {
    font-size: 50px;
  }
}

@media (max-width: 768px) {

  .search-wrapper {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  .member-dropdown {
    width: 100% !important;
    left: 0;
    right: 0;
    box-sizing: border-box;
  }

  .dropdown-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .result-banner {
    font-size: 22px;
    padding: 12px 10px;
    min-height: 60px;

    flex-direction: row;
    flex-wrap: nowrap;
    text-align: center;
    gap: 8px;
  }

  .result-banner i {
    font-size: 20px;
    line-height: 1;
  }

  .result-banner.win,
  .result-banner.draw {
    justify-content: center;
    align-items: center;
  }
}