:root {
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --warn: #f59e0b;
  --success: #10b981;
  --border: #233046;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overscroll-behavior: none;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(
      135deg,
      rgba(16, 185, 129, 0.05) 0%,
      transparent 50%
    ),
    linear-gradient(225deg, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at top, #1a3a2e 0%, #0f1419 50%, #000000 100%);
  color: var(--text);
  position: fixed;
  width: 100%;
  overflow-y: auto;
  background-attachment: fixed;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px 64px;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 -30px;
  line-height: 0;
}

.logo {
  max-width: 150px;
  width: 100%;
  height: auto;
  display: block;
}

h2 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--muted);
}

h3.section-subtitle {
  font-size: 16px;
  margin: 24px 0 8px;
  color: var(--muted);
  font-weight: 600;
}
.hint {
  color: var(--muted);
  margin: 12px 0 12px;
}

.hidden {
  display: none !important;
}

.draggable-list,
.order,
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.log {
  margin: 8px 0 0 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.log:not(.hidden) {
  max-height: 500px;
}

.draggable-list {
  touch-action: none;
}

.draggable-list li,
.order li,
.log li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
  overflow: visible;
}

.draggable-list li {
  touch-action: none;
}

.draggable-list li .controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order li {
  touch-action: pan-y;
  overflow: hidden;
  padding: 0;
  gap: 0;
  /* Ngăn chặn scroll khi đang swipe */
  overscroll-behavior-x: none;
  border-radius: 8px;
}

.swipe-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease;
  width: 100%;
  border-radius: inherit;
}

.draggable-list li:last-child,
.order li:last-child,
.log li:last-child {
  border-bottom: none;
}

.order li:last-child {
  margin-bottom: 0;
}

/* Swipe Win Indicator - Background layer */
.swipe-win-indicator {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 120px;
  background: linear-gradient(
    90deg,
    rgba(16, 185, 129, 0.3),
    rgba(16, 185, 129, 0.8)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  transition: opacity 0.15s ease;
}

.swipe-win-text {
  font-size: 32px;
  filter: drop-shadow(0 3px 8px rgba(16, 185, 129, 0.9));
  animation: pulse-win 0.6s ease-in-out infinite;
}

@keyframes pulse-win {
  0%,
  100% {
    transform: scale(1) rotate(-10deg);
  }
  50% {
    transform: scale(1.25) rotate(10deg);
  }
}

.drag-handle {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #25324a;
  border: 1px solid var(--border);
  cursor: grab;
  position: relative;
}
.drag-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 8px;
  background-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 30%,
    var(--muted) 30%,
    var(--muted) 45%,
    transparent 45%,
    transparent 55%,
    var(--muted) 55%,
    var(--muted) 70%,
    transparent 70%
  );
}

.btn-remove {
  appearance: none;
  border: 1px solid #ef4444;
  background: transparent;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
  position: relative;
  flex-shrink: 0;
}

.btn-remove::before,
.btn-remove::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 2px;
  background: #ef4444;
  transition: all 0.15s;
}

.btn-remove::before {
  transform: rotate(45deg);
}

.btn-remove::after {
  transform: rotate(-45deg);
}

.btn-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #dc2626;
}

.btn-remove:hover::before,
.btn-remove:hover::after {
  background: #dc2626;
}
.idx {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
}

/* Breaker Badge - Simple white badge */
.breaker-badge {
  background: #fff !important;
  color: #000 !important;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid var(--border);
  position: relative;
}

/* Pill Theme Animations */
.pill-theme-lightning {
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.15),
    rgba(59, 130, 246, 0.15)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.pill-theme-lightning::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(90deg, #fbbf24 0%, #3b82f6 50%, #fbbf24 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pill-border-flow 2s linear infinite;
  z-index: -1;
}

.pill-theme-fire {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.15),
    rgba(249, 115, 22, 0.15)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.pill-theme-fire::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 50%, #ef4444 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pill-border-flow 2s linear infinite;
  z-index: -1;
}

.pill-theme-ice {
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.15),
    rgba(59, 130, 246, 0.15)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.pill-theme-ice::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 50%, #06b6d4 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pill-border-flow 2s linear infinite;
  z-index: -1;
}

.pill-theme-nature {
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.15),
    rgba(16, 185, 129, 0.15)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.pill-theme-nature::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(90deg, #22c55e 0%, #10b981 50%, #22c55e 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pill-border-flow 2s linear infinite;
  z-index: -1;
}

.pill-theme-shadow {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.15),
    rgba(88, 28, 135, 0.15)
  );
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}
.pill-theme-shadow::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(90deg, #8b5cf6 0%, #581c87 50%, #8b5cf6 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pill-border-flow 2s linear infinite;
  z-index: -1;
}

@keyframes pill-border-flow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.actions.minor {
  margin-top: 6px;
}

.select {
  min-width: 140px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #172036;
  color: var(--text);
}

button {
  appearance: none;
  border: 1px solid var(--border);
  background: #172036;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
button.primary {
  background: linear-gradient(180deg, #2b62d6, var(--primary));
}
button.warn {
  background: linear-gradient(180deg, #d97706, var(--warn));
}
button.success {
  background: linear-gradient(180deg, #059669, var(--success));
}
button.secondary {
  background: #172036;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.order-wrap,
.log-wrap {
  margin-top: 16px;
}

.log-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.log-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.log-toggle-icon {
  transition: transform 0.2s;
  font-size: 12px;
}

.log-toggle.active .log-toggle-icon {
  transform: rotate(180deg);
}
.order-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.order-header {
  color: var(--muted);
}

.round-pill {
  font-size: 14px;
  font-weight: 600;
  color: #d1fae5;
  background: #065f46;
  border: 1px solid #064e3b;
  border-radius: 999px;
  padding: 5px 12px;
}
.round-ping {
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15);
  transition: box-shadow 400ms ease;
}

.current {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.current-name {
  font-size: 24px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: #1f2937;
  border: 1px solid var(--border);
}

.active {
  outline: 2px solid var(--primary);
  border-radius: 8px;
}

/* Player Themes - Base */
.theme-tag {
  font-weight: 700;
  border: none;
  padding: 3px 10px;
  font-size: 11px;
}

/* Breaker Animated Border - Enhanced for player row */
.breaker-animated::before {
  animation-duration: 2s !important; /* Faster border animation */
}

/* Lightning breaker - enhanced pulse & glow */
.breaker-animated.theme-lightning {
  animation: lightning-pulse 1.2s ease-in-out infinite,
    breaker-lightning-glow 2s ease-in-out infinite;
}
@keyframes breaker-lightning-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6),
      0 0 35px rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.9),
      0 0 50px rgba(59, 130, 246, 0.6);
  }
}

/* Fire breaker - enhanced pulse & glow */
.breaker-animated.theme-fire {
  animation: fire-pulse 1.2s ease-in-out infinite,
    breaker-fire-glow 2s ease-in-out infinite;
}
@keyframes breaker-fire-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6),
      0 0 35px rgba(249, 115, 22, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.9),
      0 0 50px rgba(249, 115, 22, 0.6);
  }
}

/* Ice breaker - enhanced pulse & glow */
.breaker-animated.theme-ice {
  animation: ice-pulse 1.2s ease-in-out infinite,
    breaker-ice-glow 2s ease-in-out infinite;
}
@keyframes breaker-ice-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6),
      0 0 35px rgba(96, 165, 250, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.9),
      0 0 50px rgba(96, 165, 250, 0.6);
  }
}

/* Nature breaker - enhanced pulse & glow */
.breaker-animated.theme-nature {
  animation: nature-pulse 1.2s ease-in-out infinite,
    breaker-nature-glow 2s ease-in-out infinite;
}
@keyframes breaker-nature-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6),
      0 0 35px rgba(52, 211, 153, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.9),
      0 0 50px rgba(52, 211, 153, 0.6);
  }
}

/* Shadow breaker - enhanced pulse & glow */
.breaker-animated.theme-shadow {
  animation: shadow-pulse 1.2s ease-in-out infinite,
    breaker-shadow-glow 2s ease-in-out infinite;
}
@keyframes breaker-shadow-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6),
      0 0 35px rgba(167, 139, 250, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.9),
      0 0 50px rgba(167, 139, 250, 0.6);
  }
}

/* Lightning Theme ⚡ */
.theme-lightning {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(251, 191, 36, 0.08) 0%,
    rgba(59, 130, 246, 0.08) 50%,
    rgba(251, 191, 36, 0.08) 100%
  );
  animation: lightning-pulse 1.5s ease-in-out infinite;
}
.theme-lightning::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  padding: 2px; /* Thicker border */
  background: linear-gradient(
    90deg,
    #fbbf24 0%,
    #3b82f6 25%,
    #fbbf24 50%,
    #3b82f6 75%,
    #fbbf24 100%
  );
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: theme-border 2.5s linear infinite; /* Faster */
  z-index: 3;
  pointer-events: none;
}
.theme-tag.theme-lightning {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1f2937;
  animation: lightning-glow 2s ease-in-out infinite;
}
@keyframes lightning-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
  }
  50% {
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.6),
      0 0 30px rgba(251, 191, 36, 0.4);
  }
}
@keyframes lightning-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(251, 191, 36, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.8),
      0 0 20px rgba(245, 158, 11, 0.4);
  }
}

/* Fire Theme 🔥 */
.theme-fire {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(239, 68, 68, 0.08) 0%,
    rgba(249, 115, 22, 0.08) 50%,
    rgba(239, 68, 68, 0.08) 100%
  );
  animation: fire-pulse 1.5s ease-in-out infinite;
}
.theme-fire::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  padding: 2px; /* Thicker border */
  background: linear-gradient(
    90deg,
    #ef4444 0%,
    #f97316 25%,
    #ef4444 50%,
    #f97316 75%,
    #ef4444 100%
  );
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: theme-border 2.5s linear infinite; /* Faster */
  z-index: 3;
  pointer-events: none;
}
.theme-tag.theme-fire {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  animation: fire-glow 2s ease-in-out infinite;
}
@keyframes fire-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 18px rgba(249, 115, 22, 0.6),
      0 0 30px rgba(239, 68, 68, 0.4);
  }
}
@keyframes fire-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8),
      0 0 20px rgba(249, 115, 22, 0.4);
  }
}

/* Ice Theme ❄️ */
.theme-ice {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(6, 182, 212, 0.08) 0%,
    rgba(59, 130, 246, 0.08) 50%,
    rgba(6, 182, 212, 0.08) 100%
  );
  animation: ice-pulse 1.5s ease-in-out infinite;
}
.theme-ice::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  padding: 2px; /* Thicker border */
  background: linear-gradient(
    90deg,
    #06b6d4 0%,
    #3b82f6 25%,
    #06b6d4 50%,
    #3b82f6 75%,
    #06b6d4 100%
  );
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: theme-border 2.5s linear infinite; /* Faster */
  z-index: 3;
  pointer-events: none;
}
.theme-tag.theme-ice {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff;
  animation: ice-glow 2s ease-in-out infinite;
}
@keyframes ice-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
  }
  50% {
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.6),
      0 0 30px rgba(6, 182, 212, 0.4);
  }
}
@keyframes ice-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(6, 182, 212, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.8),
      0 0 20px rgba(59, 130, 246, 0.4);
  }
}

/* Nature Theme 🌿 */
.theme-nature {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.08) 0%,
    rgba(16, 185, 129, 0.08) 50%,
    rgba(34, 197, 94, 0.08) 100%
  );
  animation: nature-pulse 1.5s ease-in-out infinite;
}
.theme-nature::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  padding: 2px; /* Thicker border */
  background: linear-gradient(
    90deg,
    #22c55e 0%,
    #10b981 25%,
    #22c55e 50%,
    #10b981 75%,
    #22c55e 100%
  );
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: theme-border 2.5s linear infinite; /* Faster */
  z-index: 3;
  pointer-events: none;
}
.theme-tag.theme-nature {
  background: linear-gradient(135deg, #22c55e, #10b981);
  color: #fff;
  animation: nature-glow 2s ease-in-out infinite;
}
@keyframes nature-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.6),
      0 0 30px rgba(34, 197, 94, 0.4);
  }
}
@keyframes nature-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8),
      0 0 20px rgba(16, 185, 129, 0.4);
  }
}

/* Shadow Theme 🌙 */
.theme-shadow {
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.08) 0%,
    rgba(88, 28, 135, 0.08) 50%,
    rgba(139, 92, 246, 0.08) 100%
  );
  animation: shadow-pulse 1.5s ease-in-out infinite;
}
.theme-shadow::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  padding: 2px; /* Thicker border */
  background: linear-gradient(
    90deg,
    #8b5cf6 0%,
    #581c87 25%,
    #8b5cf6 50%,
    #581c87 75%,
    #8b5cf6 100%
  );
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: theme-border 2.5s linear infinite; /* Faster */
  z-index: 3;
  pointer-events: none;
}
.theme-tag.theme-shadow {
  background: linear-gradient(135deg, #8b5cf6, #581c87);
  color: #fff;
  animation: shadow-glow 2s ease-in-out infinite;
}
@keyframes shadow-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 18px rgba(88, 28, 135, 0.6),
      0 0 30px rgba(139, 92, 246, 0.4);
  }
}
@keyframes shadow-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
  }
  50% {
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.8),
      0 0 20px rgba(88, 28, 135, 0.4);
  }
}

/* Shared border animation */
@keyframes theme-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.tappable {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tag {
  font-size: 12px;
  color: #a5b4fc;
  padding: 2px 8px;
  border: 1px solid #374151;
  border-radius: 10px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.match-info {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
}

.btn-exit {
  appearance: none;
  border: 1px solid #991b1b;
  background: linear-gradient(180deg, #dc2626, #b91c1c);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.btn-exit:hover {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

.modal.hidden {
  display: none !important;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.modal-message {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  appearance: none;
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  min-width: 100px;
  -webkit-tap-highlight-color: transparent;
}

.modal-btn.primary {
  background: linear-gradient(180deg, #2b62d6, var(--primary));
  color: white;
  border-color: var(--primary);
}

.modal-btn.secondary {
  background: #172036;
  color: var(--text);
}

.modal-btn:active {
  transform: scale(0.95);
}

/* Available players list */
.available-list {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.6);
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}

.available-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.available-player:last-child {
  border-bottom: none;
}

.empty-msg {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.btn-add {
  appearance: none;
  border: 1px solid var(--primary);
  background: transparent;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
  position: relative;
  flex-shrink: 0;
}

.btn-add::before,
.btn-add::after {
  content: "";
  position: absolute;
  background: var(--primary);
  transition: all 0.15s;
}

.btn-add::before {
  width: 12px;
  height: 2px;
}

.btn-add::after {
  width: 2px;
  height: 12px;
}

.btn-add:hover:not(.disabled) {
  background: rgba(59, 130, 246, 0.15);
  border-color: #2563eb;
}

.btn-add:hover:not(.disabled)::before,
.btn-add:hover:not(.disabled)::after {
  background: #2563eb;
}

.btn-add.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--muted);
}

.btn-add.disabled::before,
.btn-add.disabled::after {
  background: var(--muted);
}

/* ==================== Login ==================== */
/* Admin Login Button (floating) */
.admin-login-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-login-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

/* Login Modal */
#login-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#login-modal.hidden {
  display: none !important;
}

.login-modal-content {
  max-width: 400px;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  position: relative;
  z-index: 10000;
}

.login-modal-content h2 {
  margin: 0 0 24px 0;
  text-align: center;
  font-size: 24px;
}

.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
  color: var(--muted);
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.btn-primary,
.btn-secondary {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(156, 163, 175, 0.15);
  border-color: var(--muted);
}

.login-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 14px;
  text-align: center;
}

/* Empty State */
#empty-state {
  max-width: 500px;
  margin: 100px auto;
  text-align: center;
}

.empty-state-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 60px 40px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-content h2 {
  margin: 0 0 12px 0;
  color: var(--text);
}

.empty-state-content p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Logout Button (replaces admin-login-btn when logged in) */
.logout-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

/* ==================== Toast Notifications ==================== */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  font-size: 14px;
  font-weight: 500;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.warning {
  border-left: 4px solid var(--warn);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast.hiding {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ==================== Connection Banner ==================== */
.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.95) 0%,
    rgba(251, 191, 36, 0.95) 100%
  );
  color: #000;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 9998;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease-out;
}

.connection-banner.reconnecting {
  background: linear-gradient(
    90deg,
    rgba(59, 130, 246, 0.95) 0%,
    rgba(96, 165, 250, 0.95) 100%
  );
  color: white;
}

.connection-banner.hidden {
  display: none !important;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* ==================== Loading States ==================== */
button.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

button.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============ Loading Overlay ============ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
  backdrop-filter: blur(4px);
}

.loading-overlay .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-overlay .loading-text {
  position: absolute;
  top: 60%;
  color: var(--text);
  font-size: 14px;
  margin-top: 16px;
}

/* Disable interactions during loading */
body.loading {
  pointer-events: none;
  user-select: none;
}

body.loading .loading-overlay {
  pointer-events: all;
}

/* Player item disabled state */
.order li.disabled {
  opacity: 0.5;
  pointer-events: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
