:root {
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --bg-color: #1a1a1a;
  --cell-bg: rgba(255, 255, 255, 0.1);
  --cell-border: rgba(255, 255, 255, 0.2);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  min-height: 100vh;
  background: radial-gradient(circle at 50% -20%, #4a0d0d, #111111 60%, #000000 100%);
  color: white;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  margin: 0;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.05"/></svg>');
  z-index: -1;
  pointer-events: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 2rem);
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(15px);
  border-bottom: 2px solid #333;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

header h4 {
  margin: 0;
  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;
  gap: clamp(0.3rem, 1vw, 0.5rem);
  align-items: center;
}

.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.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 218, 117, 0.3);
  color: #ffda75;
  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, 218, 117, 0.15);
  box-shadow: 0 0 15px rgba(255, 218, 117, 0.4);
  border-color: #ffda75;
}

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

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

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

#streak-container {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  text-align: center;
  background: linear-gradient(180deg, #1f1f1f, #0a0a0a);
  border: 2px solid #333;
  padding: clamp(0.75rem, 2vw, 1rem);
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255,255,255,0.1);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

#streak-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, #ffda75, transparent);
  opacity: 0.5;
}

#streak-container span {
  color: #ffda75;
  text-shadow: 0 0 8px rgba(255, 218, 117, 0.6);
  font-weight: 900;
}

#game-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
}

.lives-indicator {
  display: flex;
  justify-content: center;
  gap: 5px;
  font-size: 1.5rem;
}

.life-icon {
  transition: all 0.3s;
}

.life-icon.lost {
  opacity: 0.2;
  filter: grayscale(1);
}

#input-container {
  position: relative;
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

#guess-input {
  flex: 1;
  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: white;
  border-radius: 12px;
}

#submit-btn, .action-btn {
  padding: clamp(0.6rem, 2vw, 0.8rem) clamp(1.2rem, 3vw, 1.6rem);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

#submit-btn:hover, .action-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

#submit-btn { border-color: rgba(255, 95, 95, 0.5); color: #ff7979; }
#submit-btn:hover { background: rgba(255, 95, 95, 0.15); border-color: #ff7979; box-shadow: 0 0 20px rgba(255, 95, 95, 0.4); }

#hint-btn { border-color: rgba(16, 185, 129, 0.5); color: #34d399; }
#hint-btn:hover { background: rgba(16, 185, 129, 0.15); border-color: #34d399; box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }

#cast-hint-btn { border-color: rgba(245, 158, 11, 0.5); color: #fbbf24; }
#cast-hint-btn:hover { background: rgba(245, 158, 11, 0.15); border-color: #fbbf24; box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }

#skip-btn { border-color: rgba(156, 163, 175, 0.5); color: #9ca3af; }
#skip-btn:hover { background: rgba(156, 163, 175, 0.15); border-color: #9ca3af; box-shadow: 0 0 20px rgba(156, 163, 175, 0.4); }

#submit-btn:disabled, .action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 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;
}

.dropdown-item {
  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-item:hover {
  background: rgba(255, 255, 255, 0.2);
  padding-left: 1.5rem;
}

.game-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.box.green { background: var(--green); }
.box.yellow { background: var(--yellow); }
.box.red { background: var(--red); }

.grid-wrapper {
  overflow-x: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.grid-header {
  display: grid;
  grid-template-columns: 140px 100px 180px 140px 100px 120px;
  gap: 10px;
  margin-bottom: 15px;
  min-width: 800px;
  background: rgba(10, 10, 10, 0.8);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0 10px;
}

.grid-row {
  display: grid;
  grid-template-columns: 140px 100px 180px 140px 100px 120px;
  gap: 10px;
  margin-bottom: 15px;
  min-width: 800px;
  position: relative;
  background: #111;
  padding: 10px 20px;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

/* Film strip holes */
.grid-row::before, .grid-row::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 15px;
  background-image: radial-gradient(#000 40%, transparent 45%);
  background-size: 15px 15px;
  background-repeat: repeat-y;
}
.grid-row::before { left: 0; border-right: 1px solid #333; }
.grid-row::after { right: 0; border-left: 1px solid #333; }

.cell-header {
  font-weight: 800;
  text-align: center;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: #888;
  padding: 10px 8px;
  border-bottom: 2px solid #333;
}

.grid-cell {
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 110px;
  position: relative;
  transition: transform 0.6s, background-color 0.6s, border-color 0.6s, box-shadow 0.6s;
  transform-style: preserve-3d;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.grid-cell.flip {
  animation: flipCell 0.6s forwards;
}

@keyframes flipCell {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.cell-green { 
  background-color: rgba(21, 128, 61, 0.2); 
  border-color: #22c55e; 
  color: #bbf7d0;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.3), inset 0 0 20px rgba(34, 197, 94, 0.2);
}
.cell-yellow { 
  background-color: rgba(161, 98, 7, 0.2); 
  border-color: #eab308; 
  color: #fef08a;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.3), inset 0 0 20px rgba(234, 179, 8, 0.2);
}
.cell-red { 
  background-color: rgba(185, 28, 28, 0.2); 
  border-color: #ef4444; 
  color: #fecaca;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3), inset 0 0 20px rgba(239, 68, 68, 0.2);
}

.movie-poster-cell {
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.movie-poster-cell .title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.8);
  font-size: 0.8rem;
  padding: 6px;
  backdrop-filter: blur(4px);
}

.arrow-indicator {
  font-size: 1.8rem;
  margin-top: 5px;
  opacity: 0.9;
}

/* Modals & Overlays */
#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;
  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.introtext {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  text-align: left;
}

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

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

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

#play-start-btn:hover {
  transform: translateY(-2px) scale(1.05);
  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); }
}

.overlay {
  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: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

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

.overlay-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  padding: 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

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

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

.hint-popup {
  margin-top: 15px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-style: italic;
  display: none;
}
.hint-popup.show {
  display: block;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.summary-row {
  border: 2px dashed rgba(255, 218, 117, 0.5) !important;
  background: rgba(255, 218, 117, 0.05) !important;
  margin-bottom: 25px !important;
  box-shadow: 0 0 20px rgba(255, 218, 117, 0.1);
  display: grid;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.toggle-switch input {
  display: none;
}
.toggle-switch .slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.toggle-switch .slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .slider {
  background-color: #10b981;
  border-color: #059669;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
}
.toggle-label {
  margin-left: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ccc;
  transition: color 0.3s;
}
.toggle-switch input:checked ~ .toggle-label {
  color: #10b981;
}
