/* Endgame Dual-Screen Presentation System - Shared Styles */

:root {
  /* Premium Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #15151f;
  --bg-card: rgba(25, 25, 40, 0.8);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --success: #10b981;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  /* Prevent scrolling */
  display: flex;
  flex-direction: column;
}

/* Typography */
h1 {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 400;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

/* Container */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 4rem;
  /* Consistent horizontal margins */
  height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
  transition: opacity 0.8s ease, filter 0.8s ease, transform 0.8s ease;
}

.container.video-active {
  opacity: 0;
  filter: blur(20px);
  transform: scale(0.9);
  pointer-events: none;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1rem;
  /* Less margin */
  margin-top: 1rem;
  /* Start higher */
  position: relative;
  flex-shrink: 0;
}



/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4rem;
  /* Even more gap */
  flex-grow: 1;
  align-content: center;
  /* Center vertically if there's extra space */
  max-height: 80vh;
  /* Ensure it doesn't overflow */
  padding-bottom: 4rem;
  /* More space below */
  margin: 0 2rem;
  /* Extra horizontal margin for the grid itself */
}

/* Card Styling */
.card {
  position: relative;
  aspect-ratio: 1/1;
  /* 1:1 Aspect Ratio */
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3), 0 0 60px rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
}

.card.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 40px var(--accent-glow), 0 20px 60px rgba(99, 102, 241, 0.4);
  transform: scale(1.05);
  animation: pulse-glow 2s ease-in-out infinite;
}

.card.used {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.7);
}

.card.used:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-color);
}

.card.used::before {
  opacity: 0;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 40px var(--accent-glow), 0 20px 60px rgba(99, 102, 241, 0.4);
  }

  50% {
    box-shadow: 0 0 60px var(--accent-glow), 0 20px 80px rgba(99, 102, 241, 0.6);
  }
}

.card-content {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-image {
  transform: scale(1.05);
}

.card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 400;
  font-size: 1.5rem;
  text-transform: capitalize;
  color: var(--text-primary);
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  z-index: 3;
  text-align: center;
}

/* Video Container */
.video-container {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.video-container.active {
  display: flex;
  animation: videoFadeIn 1s ease forwards;
}

@keyframes videoFadeIn {
  0% {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
  }
  50% {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.8);
  }
  100% {
    opacity: 1;
    background: #000;
  }
}

.video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(0.5);
  opacity: 0;
  filter: blur(10px);
}

.video-container.active .video-player {
  animation: videoGrow 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes videoGrow {
  0% {
    transform: scale(0.5);
    opacity: 0;
    filter: blur(10px);
  }
  60% {
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0px);
  }
}

.video-title {
  position: absolute;
  top: 3rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 400;
  font-size: 4rem;
  color: var(--text-primary);
  text-transform: capitalize;
  text-shadow: 2px 2px 20px rgba(0, 0, 0, 0.9);
  z-index: 10;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.video-title.hidden {
  opacity: 0;
}

/* Instructions */
.instructions {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.key {
  background: var(--bg-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 600;
}

/* Loading Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.card {
  animation: fadeIn 0.6s ease backwards;
}

.card:nth-child(1) {
  animation-delay: 0.1s;
}

.card:nth-child(2) {
  animation-delay: 0.15s;
}

.card:nth-child(3) {
  animation-delay: 0.2s;
}

.card:nth-child(4) {
  animation-delay: 0.25s;
}

.card:nth-child(5) {
  animation-delay: 0.3s;
}

.card:nth-child(6) {
  animation-delay: 0.35s;
}

.card:nth-child(7) {
  animation-delay: 0.4s;
}

.card:nth-child(8) {
  animation-delay: 0.45s;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .cards-grid {
    gap: 1rem;
  }

  .card-label {
    font-size: 1.2rem;
    padding: 0.8rem;
  }
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-height: none;
    overflow-y: auto;
  }

  body {
    overflow: auto;
    /* Allow scrolling on mobile if needed */
  }

  h1 {
    font-size: 2rem;
  }

  .video-title {
    font-size: 2.5rem;
    top: 2rem;
  }

  .instructions {
    display: none;
    /* Hide instructions on mobile to save space */
  }
}

/* Display Mode (Fullscreen optimized) */
body.display-mode {
  overflow: hidden;
}

body.display-mode .container {
  padding: 2rem;
  max-width: 100%;
}

body.display-mode .cards-grid {
  height: calc(100vh - 150px);
  max-height: none;
}

body.display-mode .card-label {
  display: none;
}

body.display-mode .video-title {
  display: none;
}

/* Open Display Button */
.open-display-btn {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
  z-index: 100;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.open-display-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* End Title Button */
.endtitle-btn {
  position: absolute;
  top: 2rem;
  right: 12rem;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
  z-index: 100;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.endtitle-btn:hover {
  background: rgba(139, 92, 246, 0.4);
  color: var(--text-primary);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* Reset Button */
.reset-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(220, 38, 38, 0.5);
  color: #fca5a5;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reset-btn:hover {
  background: rgba(220, 38, 38, 0.4);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

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

/* Hide header in display mode */
body.display-mode .header {
  display: none;
}

/* End Title Container */
.endtitle-container {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.endtitle-container.active {
  display: flex;
  animation: videoFadeIn 1.5s ease forwards;
}

.endtitle-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(0.95);
}

.endtitle-container.active .endtitle-video {
  animation: videoGrow 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Enable Overlay for Display Mode */
.enable-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.enable-message {
  text-align: center;
  padding: 3rem;
  background: rgba(99, 102, 241, 0.1);
  border: 2px solid var(--accent-primary);
  border-radius: 20px;
  box-shadow: 0 0 60px var(--accent-glow);
}

.enable-message h2 {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.enable-message p {
  font-size: 1.2rem;
  color: var(--text-secondary);
}