:root {
  --primary-bg: rgba(0, 0, 0, 0.7);
  --accent-color: #FF5F5F;
  --accent-hover: #FF3F3F;
  --correct-bg: rgba(0, 255, 0, 0.2);
  --incorrect-bg: rgba(255, 0, 0, 0.2);
  --text-color: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  min-height: 100vh;
  background: linear-gradient(-45deg, #435294, #a83535, #353535, #f5576c);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 2rem);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h4 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.social-icons {
  display: flex;
  gap: clamp(0.3rem, 1vw, 0.5rem);
}

.social-link,
.stats-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(32px, 5vw, 36px);
  height: clamp(32px, 5vw, 36px);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-color);
  text-decoration: none;
  font-size: clamp(1rem, 2vw, 1.1rem);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover,
.stats-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  gap: 1rem;
}

footer {
  text-align: center;
  padding: clamp(0.3rem, 1vw, 0.5rem);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  font-size: clamp(0.65rem, 1.5vw, 0.75rem);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.version {
  margin-left: 0.5rem;
  opacity: 0.7;
}

#streak-container {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: clamp(0.75rem, 2vw, 1rem);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

#streak-container span {
  color: #FFD700;
  font-weight: 800;
}


#game-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: clamp(0.6rem, 2vw, 1.25rem);
  max-width: 580px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

#stage-indicator {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#poster-container {
  margin: clamp(0.6rem, 2vw, 0.9rem) auto;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 2 / 3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

#poster-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.3s ease;
}

#loading-overlay span {
  margin-top: 1rem;
  font-weight: 700;
  color: var(--text-color);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#poster-image.stage-1 {
  filter: blur(50px);
}

#poster-image.stage-2 {
  filter: blur(30px);
}

#poster-image.stage-3 {
  filter: blur(15px);
}

#poster-image.stage-4 {
  filter: blur(7px);
}

#poster-image.stage-5 {
  /* Keep very slight blur on final stage to preserve challenge */
  filter: blur(2px);
}

#loading-indicator {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-color);
  font-weight: 700;
}

#input-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 2vw, 1rem);
  margin: clamp(1rem, 2vw, 1.5rem) 0;
  position: relative;
  width: 100%;
}

#guess-input {
  padding: clamp(0.6rem, 2vw, 0.8rem);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: var(--text-color);
  border-radius: 12px;
  flex: 1;
  min-width: 200px;
  transition: all 0.1s ease;
}

#guess-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#guess-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 20px rgba(255, 95, 95, 0.3);
}

#submit-btn {
  padding: clamp(0.6rem, 2vw, 0.8rem) clamp(1.2rem, 3vw, 1.6rem);
  background: linear-gradient(135deg, var(--accent-color), #ff7979);
  color: var(--text-color);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(255, 95, 95, 0.4);
  animation: buttonPulse 2s ease-in-out infinite;
}

#submit-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #ff5555);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(255, 95, 95, 0.6);
}

@keyframes buttonPulse {

  0%,
  100% {
    box-shadow: 0 4px 16px rgba(255, 95, 95, 0.4);
  }

  50% {
    box-shadow: 0 4px 24px rgba(255, 95, 95, 0.6);
  }
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: calc(100% - clamp(100px, 20vw, 150px));
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  margin-top: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dropdown.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

.dropdown ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown li {
  padding: clamp(0.6rem, 1.5vw, 0.8rem);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.dropdown li:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translation(4px);
}

.dropdown li:last-child {
  border-bottom: none;
}

#previous-guesses {
  margin-top: 1rem;
  text-align: left;
  max-width: 600px;
  width: 100%;
}

.guess-item,
.skip-item {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.guess-item:hover,
.skip-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.skip-item {
  color: #FFD700;
}

#reveal {
  display: none;
  text-align: center;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  max-width: 100%;
  animation: scaleIn 0.5s ease;
}

.poster-reveal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0.5rem;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  box-sizing: border-box;
  overflow: hidden;
}

.poster-reveal-overlay .movie-poster {
  width: auto;
  max-width: 100%;
  max-height: 68%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.08);
}

.poster-reveal-overlay .reveal-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  color: var(--text-color);
  text-align: center;
}

.poster-reveal-overlay #next-btn {
  margin: 0.25rem 0 0.5rem 0;
  padding: 0.45rem 0.9rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  align-self: center;
}

.poster-reveal-overlay #next-btn:hover {
  transform: translateY(-2px);
}

#reveal .movie-poster {
  max-width: 300px;
  max-height: 450px;
  width: auto;
  height: auto;
  margin: 1rem auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

#reveal strong {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--text-color);
  display: block;
  margin: 1rem 0;
  font-weight: 800;
}

.celebration-message {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  animation: pulse 1s infinite;
}

@keyframes pulse {

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

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

#share-btn,
#next-btn {
  margin: 1rem auto;
  padding: clamp(0.6rem, 2vw, 0.8rem) clamp(1.2rem, 3vw, 1.6rem);
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  display: block;
}

#share-btn:hover,
#next-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6);
}

#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.start-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 600px;
  width: 90%;
  text-align: center;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.start-content h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: 1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.start-content ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  text-align: left;
}

.start-content li {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.start-content li::before {
  content: '🎬';
  position: absolute;
  left: 0;
}

#start-loading {
  color: var(--accent-color);
  font-weight: 700;
  margin: 1rem 0;
}

#play-start-btn {
  padding: clamp(0.8rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem);
  background: linear-gradient(135deg, var(--accent-color), #ff7979);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255, 95, 95, 0.4);
  animation: buttonPulse 2s ease-in-out infinite;
  margin-top: 1.5rem;
}

#play-start-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #ff5555);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(255, 95, 95, 0.6);
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.overlay-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 20px;
  max-width: min(90%, 900px);
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  position: relative;
}

.overlay-content h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-color);
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
  font-weight: 600;
}

.achievements-section {
  margin-top: 2rem;
}

.achievements-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 800;
  text-align: center;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.achievement {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1rem 0.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.achievement.unlocked {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.5);
}

.achievement.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.achievement:hover {
  transform: translateY(-2px);
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.achievement-name {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.achievement-desc {
  font-size: 0.7rem;
  opacity: 0.7;
}

.milestone-reached {
  animation: celebratePulse 0.8s ease;
}

@keyframes celebratePulse {

  0%,
  100% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.1);
  }

  50% {
    transform: scale(0.95);
  }

  75% {
    transform: scale(1.05);
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  #poster-container {
    max-width: 300px;
  }

  #input-container {
    flex-direction: column;
    align-items: stretch;
  }

  #guess-input {
    width: 100%;
    min-width: 0;
  }

  #submit-btn {
    width: 100%;
  }

  .dropdown {
    width: 100%;
  }

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

@media (max-width: 480px) {
  #poster-container {
    max-width: 250px;
  }

  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
}

.result-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.result-popup {
  width: 100%;
  max-width: 560px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.result-popup .popup-poster {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.result-popup .popup-title {
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}

.result-popup .popup-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.result-popup .popup-actions button {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.result-popup .btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

.game-blurred {
  filter: blur(6px) saturate(0.9);
  pointer-events: none;
  user-select: none;
}