@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;700;800&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Assistant', sans-serif;
  background: #0a0a1a;
  color: #e9f2fb;
  padding: 20px;
  direction: rtl;
  overflow-x: hidden;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(120, 80, 255, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 60%, rgba(255, 100, 150, 0.05) 0%, transparent 50%);
  z-index: -1;
}

/* כפתור חזרה */
.home-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b8c5d4;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 100;
  text-decoration: none;
  display: inline-block;
}

.home-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 20px auto;
  display: flex;
  gap: 24px;
}

/* Left Panel - Game Area */
.left-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px;
  border-radius: 20px;
  flex: 7;
  position: relative;
  min-height: 500px;
  backdrop-filter: blur(5px);
}

/* Right Panel - Controls */
.right-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px;
  border-radius: 20px;
  flex: 3;
  backdrop-filter: blur(5px);
}

.right-panel h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffd700;
  margin-bottom: 14px;
}

/* Image Container */
.image-container {
  text-align: center;
  margin-bottom: 16px;
  height: 400px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.image-container img {
  max-height: 100%;
  max-width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  user-select: none;
  pointer-events: none;
}

.prompt-text {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 14px;
  min-height: 40px;
  user-select: none;
  color: #b8a9ff;
}

/* Timer */
.timer-vertical {
  position: absolute;
  top: 28px;
  right: -50px;
  width: 30px;
  height: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timer-fill {
  width: 100%;
  background: linear-gradient(180deg, #ff6b6b, #ee5a24);
  border-radius: 15px 15px 0 0;
  position: absolute;
  bottom: 0;
  height: 100%;
  transition: height 1s linear;
}

/* Controls */
.controls {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 24px;
}

.controls button {
  flex: 1;
  padding: 16px 0;
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.controls button:hover:enabled {
  transform: translateY(-2px);
}

.controls button#correctBtn {
  background: linear-gradient(135deg, #28a745, #34ce57);
  color: white;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.controls button#correctBtn:hover:enabled {
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}

.controls button#passBtn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.controls button#passBtn:hover:enabled {
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.controls button#nextBtn {
  background: linear-gradient(135deg, #6d5cff, #8b79ff);
  color: white;
  box-shadow: 0 4px 15px rgba(109, 92, 255, 0.3);
}

.controls button#nextBtn:hover:enabled {
  box-shadow: 0 6px 20px rgba(109, 92, 255, 0.5);
}

.controls button:disabled {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #555 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

/* Inputs & Buttons */
input, select {
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  color: #e9f2fb;
  font-family: 'Assistant', sans-serif;
}

input:focus, select:focus {
  outline: none;
  border-color: rgba(109, 92, 255, 0.5);
}

button {
  font-family: 'Assistant', sans-serif;
  font-size: 1rem;
  padding: 12px;
  border-radius: 10px;
  border: none;
  margin-top: 10px;
  width: 100%;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
}

#startGameBtn {
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  color: white;
  font-size: 1.1rem;
  padding: 14px;
  box-shadow: 0 4px 15px rgba(192, 132, 252, 0.3);
}

#startGameBtn:hover:enabled {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192, 132, 252, 0.5);
}

#addTeamBtn {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #1a1a2e;
  font-weight: 800;
}

#addTeamBtn:hover {
  transform: translateY(-2px);
}

#resetGameBtn, #pauseBtn, #pauseAudio {
  background: rgba(255, 255, 255, 0.06);
  color: #9aa6b2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.95rem;
  padding: 10px;
}

#resetGameBtn:hover, #pauseBtn:hover, #pauseAudio:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

/* Teams List */
.teams-list {
  margin-top: 12px;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.team-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 16px;
  border-radius: 10px;
  align-items: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.team-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.team-name {
  font-weight: 700;
  color: #e0d4ff;
}

.score-number {
  font-weight: 900;
  font-size: 1.6rem;
  color: #ffd700;
  min-width: 50px;
  text-align: center;
}

.previous-score {
  font-weight: bold;
  color: #ffd700;
  text-shadow: 1px 1px 4px black;
}

label {
  font-weight: 700;
  margin-top: 14px;
  display: block;
  color: #9aa6b2;
  font-size: 0.95rem;
}

/* Score Animations */
.score-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5rem;
  font-weight: 900;
  z-index: 9998;
  pointer-events: none;
  animation: scorePopUp 1.2s ease-out forwards;
  text-shadow: 0 0 20px currentColor;
}

.score-animation.positive {
  color: #28a745;
}

.score-animation.negative {
  color: #e74c3c;
}

@keyframes scorePopUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  50% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

.mini-confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  z-index: 9997;
  pointer-events: none;
  animation: confettiFall 1.2s ease-out forwards;
}

@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(120px) rotate(720deg) scale(0.3); }
}

.sad-emoji {
  position: fixed;
  font-size: 4rem;
  z-index: 9997;
  pointer-events: none;
  animation: sadFall 1.5s ease-out forwards;
}

@keyframes sadFall {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  20% { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateY(80px) scale(0.6) rotate(20deg); }
}

/* Overlays - Shared */
#chooseFirstTeamOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.95);
  color: white;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1001;
  padding: 20px;
  backdrop-filter: blur(10px);
}

#chooseTeamList {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
}

#chooseTeamList button {
  width: 100%;
  padding: 16px 30px;
  font-size: 1.3rem;
  font-weight: bold;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #6d5cff, #8b79ff);
  color: white;
  box-shadow: 0 4px 15px rgba(109, 92, 255, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chooseTeamList button:hover:enabled {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(109, 92, 255, 0.6);
  background: linear-gradient(135deg, #8b79ff, #a594ff);
}

#chosenOrderList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
}

.chosen-team-item {
  background: linear-gradient(135deg, #28a745, #34ce57);
  color: white;
  padding: 12px 25px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  width: 100%;
  max-width: 400px;
  animation: popIn 0.3s ease;
}

#nextTeamOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.92);
  color: white;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

#startNextTeamBtn {
  margin-top: 20px;
  padding: 18px 40px;
  font-size: 1.5rem;
  cursor: pointer;
  width: fit-content;
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  color: white;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(192, 132, 252, 0.4);
}

#startNextTeamBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(192, 132, 252, 0.6);
}

#nextlevel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.95);
  color: white;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

#nextlevel button {
  display: block;
  margin: 10px auto;
  border-radius: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease;
  width: fit-content;
}

#nextlevel button:hover {
  transform: scale(1.05);
}

#startNextTeamBtn2 {
  margin-top: 20px;
  padding: 18px 35px;
  font-size: 1.4rem;
  cursor: pointer;
  width: fit-content;
}

#timeOut {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.92);
  color: white;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

/* Winners Overlay */
#winnersOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.96);
  color: #ffd700;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  padding: 20px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(10px);
}

#winnersOverlay.show {
  opacity: 1;
  pointer-events: auto;
}

#winnersOverlay h2 {
  font-size: 2.8rem;
  margin-bottom: 20px;
  color: #ffd700;
  animation: glow 2s ease-in-out infinite alternate;
}

#winnersOverlay ul {
  list-style: none;
  padding: 0;
  margin: 0 0 30px 0;
}

#winnersOverlay ul li {
  margin: 10px 0;
  font-size: 1.8rem;
  animation: popIn 0.5s ease forwards;
}

#winnersOverlay p {
  font-size: 1.2rem;
  color: #b8c5d4;
  max-width: 500px;
  line-height: 1.8;
}

#winnersOverlay button {
  font-size: 1.4rem;
  padding: 16px 30px;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #1a1a2e;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  transition: transform 0.3s, box-shadow 0.3s;
  width: fit-content;
  margin-top: 20px;
}

#winnersOverlay button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
}

/* Songs Level */
#songsLevel {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.96);
  color: #ffd700;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  padding: 20px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(10px);
}

#songsLevel.show {
  opacity: 1;
  pointer-events: auto;
}

#startSongsLevel {
  width: fit-content;
  padding: 14px 30px;
  font-size: 1.3rem;
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  color: white;
  border-radius: 14px;
}

/* Message Box */
#messageBox {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 40, 40, 0.95);
  color: #fff;
  font-family: 'Assistant', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 28px;
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(10px);
}

#messageBox.show {
  opacity: 1;
}

#messageBox.success {
  background: linear-gradient(135deg, #28a745, #34ce57);
}

#messageBox.error {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
}

#messageBox.info {
  background: linear-gradient(135deg, #6d5cff, #8b79ff);
}

/* Pause Overlay */
.pause-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  backdrop-filter: blur(10px);
}

.pause-overlay.hidden {
  display: none;
}

.pause-content {
  text-align: center;
  color: white;
  animation: fadeIn 0.5s ease;
}

.pause-content h1 {
  font-size: 3rem;
  color: #ffd700;
  margin-bottom: 20px;
}

.resume-btn {
  background: linear-gradient(135deg, #28a745, #34ce57) !important;
  color: white !important;
  border: none;
  border-radius: 14px;
  padding: 18px 45px !important;
  font-size: 1.5rem !important;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
  transition: transform 0.2s;
  width: fit-content !important;
}

.resume-btn:hover {
  transform: scale(1.05);
}

/* Animations */
@keyframes glow {
  from { text-shadow: 0 0 8px #ffcc00; }
  to { text-shadow: 0 0 25px #ffe066; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* Stats Overlay */
#statsOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.96);
  color: white;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  z-index: 9999;
  padding: 30px;
  backdrop-filter: blur(10px);
}

#statsOverlay.show {
  display: flex;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 24px;
  margin: 8px 0;
  font-size: 1.2rem;
  max-width: 400px;
  width: 100%;
  animation: popIn 0.4s ease forwards;
  opacity: 0;
}

.stat-item .stat-label {
  color: #8899aa;
  font-size: 0.95rem;
}

.stat-item .stat-value {
  color: #ffd700;
  font-weight: 800;
  font-size: 1.4rem;
}

/* Overtake Animation */
.overtake-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 900;
  color: #c084fc;
  z-index: 9996;
  pointer-events: none;
  animation: overtakePop 2s ease-out forwards;
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.6);
  text-align: center;
}

@keyframes overtakePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  40% { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.7); }
}

/* Countdown */
#countdownOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.92);
  z-index: 9998;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

#countdownNumber {
  font-size: 10rem;
  font-weight: 900;
  color: #ffd700;
  animation: countPop 0.8s ease;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
}

@keyframes countPop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    max-width: 100%;
  }
  
  .left-panel {
    min-height: 350px;
  }
  
  .image-container {
    height: 280px;
  }
  
  .timer-vertical {
    right: -40px;
    height: 280px;
  }
  
  .controls button {
    font-size: 1rem;
    padding: 12px 0;
  }
  
  .score-animation {
    font-size: 3.5rem;
  }
}
