/* ==========================================================================
   IMITATION PURE WIDESCREEN MINIMAL STYLING
   ========================================================================== */

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset and Fullscreen Backdrop Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: #000000; /* Pure black backdrop */
  color: #ffffff;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Widescreen Canvas that perfectly maps our native 2549x1434 background aspect ratio */
.canvas-wrapper {
  position: relative;
  width: 100vw;
  max-width: 177.75vh; /* 1.7775 constraint based on height (100vh * 1.7775) */
  height: 56.26vw;
  max-height: 100vh; /* 1.7775 constraint based on width (100vw / 1.7775) */
  aspect-ratio: 2549 / 1434;
  background-color: #000000;
  overflow: hidden;
}

/* Dynamic Smooth Matrix Zoom Transitions */
.grid-container {
  width: 100%;
  height: 100%;
  position: relative;
  transform-origin: center center;
  /* Animating ONLY transform ensures a perfect, straight linear zoom glide */
  transition: transform 1.2s cubic-bezier(0.85, 0, 0.15, 1);
  will-change: transform;
}

/* Background image layer */
.bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 1;
}

/* 10x10 Grid cells layer */
.grid-cells-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  z-index: 2;
}

/* Individual Cell styling */
.grid-cell {
  position: relative;
  cursor: default;
  z-index: 2;
}

/* Zoomed in Grid overrides */
.grid-container.zoomed .grid-cell {
  cursor: default;
}

/* Video Layer container */
.video-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Clicks register on canvas container to zoom out */
  z-index: 3;
}

.tile-video-player {
  position: absolute;
  width: 10%;
  height: 10%;
  object-fit: fill; /* Fill cell area perfectly without sub-pixel cropping */
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 3;
}

.tile-video-player.visible {
  opacity: 1;
}

/* ==========================================================================
   DIAGNOSTIC & TOAST OVERLAYS (TRIGGERS ON KEYSTROKES)
   ========================================================================== */

/* Green and Red Diagnostics Map overlay */
.grid-container.show-diagnostics .grid-cell.has-video {
  background-color: rgba(40, 167, 69, 0.35) !important;
  outline: 1px solid rgba(40, 167, 69, 0.9) !important;
}

.grid-container.show-diagnostics .grid-cell:not(.has-video) {
  background-color: rgba(220, 53, 69, 0.35) !important;
  outline: 1px solid rgba(220, 53, 69, 0.9) !important;
}

/* Toast alert notification styling */
.toast-container {
  position: fixed;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.95);
  color: #000000;
  padding: 12px 28px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
}

.toast-container.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Subtle, elegant instruction overlay inside the canvas wrapper */
#audio-instruction {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#audio-instruction.visible {
  opacity: 1;
}
