/* Font Imports */
@font-face {
  font-family: "Big Caslon";
  src: url('./fonts/BigCaslon.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Eurostile LT Std";
  src: url('./fonts/EurostileLTStd-Ex2.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

/* Base + safe areas */
:root{
  --bg:#f1f1f1;
  --ink:#111;
  --accent:#7e74ff;
  /* iOS/Android browser safe-area insets */
  --sat-top: env(safe-area-inset-top, 0px);
  --sat-bottom: env(safe-area-inset-bottom, 0px);
  --sat-left: env(safe-area-inset-left, 0px);
  --sat-right: env(safe-area-inset-right, 0px);
}

*{
  box-sizing:border-box;
}

/* Complete reset and bulletproof centering setup */
html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: relative;
  background: #f8f8f8;
  color: #111;
  font: 14px/1.3 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Tablet and desktop breakpoints moved to end of file for proper cascade */

/* Large mobile devices - keep phone frame but scale appropriately */
@media (min-width: 481px) and (max-width: 767px) {
  .phone {
    position: fixed;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* Tablet view - scale phone container to fit within viewport */
@media (min-width: 768px) and (max-width: 1024px) {
  .phone {
    position: fixed;
    transform: translate(-50%, -50%) scale(0.8);
  }
  
  /* Tablet play button styling - consistent with desktop and mobile */
  .play-pause-btn {
    min-width: 50px;
    height: 26px;
    padding: 0 12px;
    font-size: 9px;
    font-weight: 500;
    border-radius: 13px;
  }
}

/* (moved to end of file to ensure cascade wins) */

/* Mobile-specific body adjustments */
@media (max-width: 480px) {
  html, body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    margin: 0;
    padding: 0;
  }
  
  /* CSS custom properties for safe areas */
  :root {
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --mobile-button-spacing: max(20px, calc(var(--safe-area-inset-bottom) + 20px));
  }
}

/* PHONE frame kept (name/class retained) */
.phone {
  /* Fixed dimensions */
  width: 390px;
  height: 844px;
  
  /* Different centering approach */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  /* No margins/padding that could interfere */
  margin: 0;
  padding: 0;
  
  /* Visual styling */
  background: var(--bg);
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.20);
  border: none;
  box-sizing: border-box;
  
  /* Layout */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  
  /* Stacking */
  z-index: 1000;
}

/* Background image container */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* Behind all content */
  pointer-events: none; /* Allow interactions to pass through */
  background-image: url('./imgs/Desktop_Bg_img.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover; /* Cover the entire area */
}

.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover; /* Cover the entire area */
  width: 100%;
  height: 100%;
}

/* Specific background layers with z-index ordering */
.background-fence {
  background-image: url('./imgs/Fence_Bg.png');
  z-index: 1; /* Bottom layer */
  mix-blend-mode: lighten;
}

.background-shadows {
  background-image: url('./imgs/Shadows.png');
  z-index: 2; /* Top layer (appears above fence) */
}

/* Temporary additional texture layer for testing */
.background-texture {
  background-image: url('./imgs/Texture.png');
  z-index: 1; /* Between fence and shadows */
  background-size: repeat; /* Tile the texture */
  transition: mix-blend-mode 0.8s ease-in-out;
}

/* Phone internal background container */
.phone-background-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Behind canvas but visible */
  pointer-events: none;
}

/* Phone background layers - same images but positioned within phone */
.phone-background-fence {
  background-image: url('./imgs/Fence_Bg.png');
  z-index: 1;
  mix-blend-mode: exclusion;
}

.phone-background-texture {
  background-image: url('./imgs/Texture.png');
  z-index: 2;
  background-size: repeat;
  background-position: center;
}

.phone-background-shadows {
  background-image: url('./imgs/Shadows.png');
  z-index: 3;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Mobile responsive adjustments - Smart safe area positioning */
@media (max-width: 480px) {
  /* Individual button positioning removed - let container handle positioning */
  
  .top-btn {
    top: calc(var(--safe-area-inset-top, 0px) + 80px);
    width: 80.5px; /* 15% bigger (70px * 1.15) */
    height: 80.5px; /* 15% bigger (70px * 1.15) */
  }
  
  .draw-btn {
    transform: translateX(-120.75px); /* Adjusted for 80.5px width - no gap */
  }
  
  .credits-btn {
    transform: translateX(40.25px); /* Adjusted for 80.5px width - no gap */
  }
}

/* Viewport height specific adjustments for browser UI */
@media (max-width: 480px) and (max-height: 932px) and (min-height: 800px) {
  /* Individual button positioning removed - let container handle positioning */
}

@media (max-width: 480px) and (max-height: 800px) and (min-height: 700px) {
  /* Individual button positioning removed - let container handle positioning */
}

@media (max-width: 480px) and (max-height: 700px) and (min-height: 600px) {
  /* Individual button positioning removed - let container handle positioning */
}

@media (max-width: 320px) {
  /* Very small devices - compact buttons */
  .bg-toggle-btn,
  .drip-toggle-btn,
  .export-btn,
  .done-btn {
    width: 50px !important;
    height: 50px !important;
    font-size: 20px !important;
  }
  
  .bg-toggle-btn {
    left: max(15px, var(--safe-area-inset-left)) !important;
  }
  
  .drip-toggle-btn {
    right: max(15px, var(--safe-area-inset-right)) !important;
  }
}

/* Landscape mode adjustments */
@media (max-width: 480px) and (max-height: 500px) {
  /* Individual button positioning removed - let container handle positioning */
}

/* Very short viewports (keyboard visible, etc.) */
@media (max-width: 480px) and (max-height: 400px) {
  /* Individual button positioning removed - let container handle positioning */
}

/* Tablet responsive mode */
/* Tablet breakpoint - keep mobile size viewport (moved to top for proper cascade) */

/* Mobile fullscreen mode - Fill viewport on small mobile devices only */
@media (max-width: 480px){
  .phone{
    width: 100vw; 
    height: 100vh; 
    height: 100dvh; /* Use dynamic viewport height when supported */
    border-radius: 0; 
    box-shadow: none;
    top: var(--safe-area-inset-top);
    left: var(--safe-area-inset-left);
    right: var(--safe-area-inset-right);
    bottom: var(--safe-area-inset-bottom);
    transform: none;
    position: fixed;
    padding: 0;
  }
  
  /* Ensure background containers also fill the screen with safe areas */
  .background-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    top: var(--safe-area-inset-top);
    left: var(--safe-area-inset-left);
    right: var(--safe-area-inset-right);
    bottom: var(--safe-area-inset-bottom);
  }
  
  /* Adjust canvas sizing for fullscreen with safe areas */
  #draw, #background-canvas {
    width: calc(100vw - var(--safe-area-inset-left) - var(--safe-area-inset-right));
    height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    height: calc(100dvh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    top: var(--safe-area-inset-top);
    left: var(--safe-area-inset-left);
  }
  
  /* Make all stage backgrounds fill the screen with safe areas on mobile */
  .stage-background,
  .stage-background-bg02,
  .stage-background-bg03,
  .stage-background-bg04,
  .stage-background-bg05 {
    width: calc(100vw - var(--safe-area-inset-left) - var(--safe-area-inset-right));
    height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    height: calc(100dvh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    top: var(--safe-area-inset-top);
    left: var(--safe-area-inset-left);
  }
  
  /* Hide the bottom bar on mobile fullscreen */
  .bottombar {
    display: none !important;
  }
}

/* Top and bottom bars respect browser safe areas */
/* Topbar removed */
/* Bottom bar removed */

/* Stage (drawing region) - moved styles to combined definition below */

/* Stage container */
.stage{
  position: relative;
  flex: 1;
  padding: 0;
  z-index: 50; /* Above background layers but below UI elements */
}

/* Base background layer - White background for lighten blend effect */
.stage-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 1; /* Bottom layer */
  pointer-events: none;
  border: none;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

/* Background 2: bg_02.png */
.stage-background-bg02 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/bg_02.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2; /* Above main background (1) but below background-canvas (20) */
  opacity: 0; /* Hidden by default */
  transition: opacity 1.2s ease-in-out, background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out;
  pointer-events: none;
}

/* Background 3: bg_03.png */
.stage-background-bg03 {
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: calc(100% + 4px);
  background-image: url('./imgs/bg_03.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 2; /* Above main background (1) but below background-canvas (20) */
  opacity: 0; /* Hidden by default */
  transition: opacity 1.2s ease-in-out, background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out;
  pointer-events: none;
}

/* Background 4: bg_04.png */
.stage-background-bg04 {
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: calc(100% + 4px);
  background-image: url('./imgs/bg_04.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 2; /* Above main background (1) but below background-canvas (20) */
  opacity: 0; /* Hidden by default */
  transition: opacity 1.2s ease-in-out, background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out;
  pointer-events: none;
}

/* Background 5: bg_05.png */
.stage-background-bg05 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/bg_05.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2; /* Above main background (1) but below background-canvas (20) */
  opacity: 0; /* Hidden by default */
  transition: opacity 1.2s ease-in-out, background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out;
  pointer-events: none;
}


/* Show/hide backgrounds */
.stage-background.active {
  opacity: 1;
}

/* All background containers use opacity transition, no active class needed for bg02-bg05 */

/* Fence with exclusion blend over white background */
.stage-background::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/Fence_Bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: exclusion;
  z-index: 2; /* Above white background */
  pointer-events: none;
}

/* TESTING: All other layers hidden - only Fence_Bg.png visible */

/* Shadows layer removed - using HTML shadows element instead */

/* Shadows with darken blend mode when credits are active */
.shadows-element.credits-active {
  mix-blend-mode: multiply !important;
  transition: mix-blend-mode 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
}

/* Fence with exclusion blend mode when credits are active */
.background-layer.background-texture.credits-active {
  mix-blend-mode: hard-light !important;
  transition: mix-blend-mode 1.2s ease-in-out !important;
}

/* Graphic Element with darken blend mode and highest z-index when credits are active */
.graphic-element.credits-active {
  mix-blend-mode: darken !important;
  z-index: 15; /* Highest z-index when credits are active */
  transition: mix-blend-mode 1.2s ease-in-out !important;
}

/* Texture Element with highest z-index when credits are active */
.texture-element.credits-active {
  z-index: 25; /* Even higher z-index when credits are active */
  opacity: 1;
  transition: opacity 1.2s ease-in-out !important;
}

/* Star Grid with reduced opacity when credits are active - show on all backgrounds */
.star-grid-element.credits-active,
#background-2.credits-active .star-grid-element,
#background-3.credits-active .star-grid-element,
#background-4.credits-active .star-grid-element,
#background-5.credits-active .star-grid-element {
  opacity: 0.6 !important; /* 60% opacity - visible on all backgrounds when credits active */
  transition: opacity 1.2s ease-in-out, mix-blend-mode 1.2s ease-in-out !important;
}

/* All backgrounds with exclusion blend mode when credits are active */
/* Individual background behaviors defined below */

/* Background-specific behaviors when credits are active */

/* Background 1: Grey overlay with hard-light blend mode */
/* No special background image blend mode needed - overlay handles the effect */

/* Background 1: Add smooth transition for credits-active state */
#background-1.credits-active {
  opacity: 0.7 !important; /* 70% opacity for credits state - same as other backgrounds */
  transition: opacity 1.2s ease-in-out !important;
}

/* Background 2: Exclusion blend mode with white background for light/silver effect */
#background-2.credits-active {
  background-blend-mode: exclusion !important;
  background-color: white !important; /* Light background to create light/silver effect with exclusion */
  opacity: 0.7 !important; /* 70% opacity for credits state */
  transition: background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
}

/* Black overlay for background 2 when credits are active */
#background-2.credits-active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0.5;
  z-index: 10; /* Above the background image but below other elements */
  pointer-events: none;
}

/* Background 3: Exclusion blend mode with white background for light/silver effect */
#background-3.credits-active {
  background-blend-mode: exclusion !important;
  background-color: white !important; /* Light background to create light/silver effect with exclusion */
  opacity: 0.7 !important; /* 70% opacity for credits state - same as background 2 */
  transition: background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
}

/* Black overlay for background 3 when credits are active */
#background-3.credits-active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0.5;
  z-index: 10; /* Above the background image but below other elements */
  pointer-events: none;
}

/* Background 4: Exclusion blend mode with white background for light/silver effect */
#background-4.credits-active {
  background-blend-mode: exclusion !important;
  background-color: white !important; /* Light background to create light/silver effect with exclusion */
  opacity: 0.7 !important; /* 70% opacity for credits state - same as background 2 */
  transition: background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
}

/* Black overlay for background 4 when credits are active */
#background-4.credits-active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0.5;
  z-index: 10; /* Above the background image but below other elements */
  pointer-events: none;
}

/* Background 5: Exclusion blend mode with white background for light/silver effect */
#background-5.credits-active {
  background-blend-mode: exclusion !important;
  background-color: white !important; /* Light background to create light/silver effect with exclusion */
  opacity: 0.7 !important; /* 70% opacity for credits state - same as background 2 */
  transition: background-blend-mode 1.2s ease-in-out, background-color 1.2s ease-in-out, opacity 1.2s ease-in-out !important;
}

/* Graphic Element positioned on right edge with darken blend - ONLY for background 1 */
.graphic-element {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background-image: url('./imgs/Graphic Element.png');
  background-size: auto;
  background-position: right center;
  background-repeat: no-repeat;
  mix-blend-mode: darken;
  z-index: 19; /* Just below texture element (z-index: 20) */
  pointer-events: none;
  transition: mix-blend-mode 0.8s ease-in-out;
}

/* Tag Element at very bottom - ONLY for background 1 */
.tag-element {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 391px;
  height: 157px;
  background-image: url('./imgs/Tag.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: difference;
  z-index: 10; /* Higher z-index to be visible */
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Hide tag element when drawing mode is active */
.stage.drawing-mode .tag-element {
  display: none;
}

/* Hide tag element permanently once it has been hidden */
.stage.tag-hidden .tag-element {
  display: none;
}

/* Tag Stroke Element - same position as tag but one layer above */
.tag-stroke-element {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 391px; /* Same as tag element */
  height: 157px; /* Same as tag element */
  background-image: url('./imgs/Tag stroke.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: normal;
  z-index: 11; /* One layer above tag element (z-index: 10) */
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Hide tag stroke element when drawing mode is active */
.stage.drawing-mode .tag-stroke-element {
  display: none;
}

/* Hide tag stroke element permanently once it has been hidden */
.stage.tag-hidden .tag-stroke-element {
  display: none;
}

/* Mobile responsive adjustments for tag elements */
@media (max-width: 767px) {
  .tag-element {
    width: 100%; /* Span full width of phone container */
    height: 157px; /* Keep original desktop height for proper scale */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    bottom: 0; /* Ensure it stays at the bottom */
    left: 0; /* Full width positioning */
    transform: none; /* Remove centering transform */
  }
  
  .tag-stroke-element {
    width: 100%; /* Span full width of phone container */
    height: 157px; /* Keep original desktop height for proper scale */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    bottom: 0; /* Ensure it stays at the bottom */
    left: 0; /* Full width positioning */
    transform: none; /* Remove centering transform */
  }
}

/* Texture Element positioned on left edge - ONLY for background 1 */
.texture-element {
  position: absolute;
  top: 200px;
  left: 0;
  width: 50%;
  height: 100%;
  background-image: url('./imgs/Texture.png');
  background-size: auto;
  background-position: left center;
  background-repeat: no-repeat;
  z-index: 20; /* Very high z-index to appear on top */
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
}

/* Star Grid overlay removed - using only .star-grid-element for consistency */

/* Star Grid at very top layer - visible by default only on background 1 */
.star-grid-element {
  position: absolute;
  top: calc(-20px - 18px); /* Base -20px - 18px adjustment = -38px (moved UP 2 more pixels) */
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/Star Grid.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: multiply;
  z-index: 6; /* Very top layer within background 1 - above overlay and shadows */
  pointer-events: none;
  transition: opacity 0.8s ease-in-out, mix-blend-mode 0.8s ease-in-out;
}

/* Hide Star Grid on backgrounds 2-5 by default (only show on background 1 during normal mode) */
#background-2 .star-grid-element,
#background-3 .star-grid-element,
#background-4 .star-grid-element,
#background-5 .star-grid-element {
  opacity: 0;
}

/* Mobile positioning for star grid - consistent with desktop */
@media (max-width: 767px) {
  .star-grid-element {
    top: calc(-20px - 18px + 8px + 25px); /* Desktop base - adjustment + mobile offset + 20px down = -6px */
  }
}

/* TESTING: Fence background at TOP LAYER for visibility test */
/* Uncomment when Fence_Bg.png is added to imgs folder */
/*
.stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/Fence_Bg.png');
  background-size: cover;
  
  background-position: center;
  background-repeat: no-repeat;
  z-index: 10;
  pointer-events: none;
}
*/

/* Transparent canvas overlay */
/* Background canvas for the reveal effect */
#background-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20; /* Above all background layers (1-6), below main canvas (50) */
  margin: 0;
  border: none;
  background: transparent;
  pointer-events: none; /* Not interactive */
}

/* Main drawing canvas */
#draw {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 50; /* Above everything for interaction */
  margin: 0;
  border: none;
  background: transparent;
  background-color: transparent;
  transition: z-index 0.3s ease;
}

/* Drawing Canvas - behind background when not in drawing mode */
#draw.behind-background {
  z-index: 1.5; /* Between base background (1) and background images (2) - visible but underneath PNGs */
}

/* Force canvas behind background PNGs when credits are active */
#draw.credits-mode {
  z-index: 20 !important; /* Above background images (z-index: 10) to test visibility */
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  mix-blend-mode: exclusion !important; /* Make white paint blend with background */
}

/* Invert white paint when audio mode is active */
#draw.audio-invert-mode {
  mix-blend-mode: difference !important; /* Invert white paint to black */
  transition: mix-blend-mode 0.5s ease-in-out !important;
}

/* Make background images higher z-index when credits are active */
#background-2.credits-active.stage-background-bg02,
#background-3.credits-active.stage-background-bg03,
#background-4.credits-active.stage-background-bg04,
#background-5.credits-active.stage-background-bg05 {
  z-index: 10 !important; /* Much higher than canvas (z-index: 1) when credits active */
}

/* Roughen the drawn edges slightly using the SVG filter (supported on modern mobile browsers).
   If a browser doesn't support it, strokes will remain clean. */
.rough{ filter: url(#rough-edges); }

/* Coordinate display removed - was causing scrolling issues */

/* Background Toggle Button */
.bg-toggle-btn {
  width: 50px !important;
  height: 50px !important;
  border: none !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: white !important;
  font-size: 24px !important;
  cursor: pointer !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.bg-toggle-icon {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  filter: brightness(1.2) contrast(1.1) !important; /* Make more visible */
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  transition: all 0.3s ease !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.bg-toggle-btn:hover {
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.bg-toggle-btn:hover .bg-toggle-icon {
  opacity: 0.3 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

.bg-toggle-btn:active {
  transform: none !important;
  box-shadow: none !important;
}

.bg-toggle-btn:active .bg-toggle-icon {
  opacity: 0.2 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

/* Done Button - Consolidated */
.done-btn {
  width: 110.4px !important; /* 15% bigger than 96px */
  height: 110.4px !important; /* 15% bigger than 96px */
  border: none !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: white !important;
  font-size: 24px !important;
  cursor: pointer !important;
  z-index: 1 !important; /* Lower z-index so it's below other buttons */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: none !important;
  padding: 0 !important;
  flex-shrink: 0;
  margin-right: 5px;
  position: relative;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
  will-change: opacity, visibility, transform;
}

.done-icon {
  width: 180% !important;
  height: 180% !important;
  object-fit: contain !important;
  filter: brightness(1.2) contrast(1.1) !important; /* Make more visible */
  opacity: 1;
  mix-blend-mode: normal !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.done-btn:hover .done-icon {
  opacity: 0.7;
}

.done-btn:active .done-icon {
  opacity: 0.5;
}

/* Drip Style Toggle Button */
.drip-toggle-btn {
  width: 60px !important;
  height: 40px !important;
  border: none !important;
  border-radius: 8px !important;
  background: rgba(0, 0, 0, 0.7) !important;
  color: white !important;
  font-size: 24px !important;
  cursor: pointer !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}



.drip-toggle-btn.reveal-mode {
  background: rgba(70, 120, 200, 0.8) !important;
  color: white !important;
}




.export-btn:hover {
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.export-btn:hover .export-icon {
  opacity: 0.3 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

.export-btn:active {
  transform: none !important;
  box-shadow: none !important;
}

.export-btn:active .export-icon {
  opacity: 0.2 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

.brand{font-weight:700}
.meta{opacity:.6}
.btn{
  appearance:none; border:1px solid #c8c8cf; background:white;
  padding:8px 12px; border-radius:999px; font-weight:600;
}

/* Drawing Controls Container */
.drawing-controls {
  position: absolute;
  bottom: -20px;
  left: 10px;
  right: 10px;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  flex-wrap: nowrap;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show controls when drawing mode is active */
.stage.drawing-mode .drawing-controls {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Button styling */
.bg-toggle-btn {
  width: 35px !important;
  height: 35px !important;
  background: #f8f8f8 !important; /* Default background color */
  border: 2px solid #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
  z-index: 10 !important; /* Higher z-index to be above close button */
  flex-shrink: 0;
  margin-right: 5px;
  transition: opacity 0.45s ease-out, filter 0.5s ease-out;
}

/* Square reveal preview of next background for bg toggle */
.bg-toggle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background-image: var(--next-bg-image, url('./imgs/bg_02.png'));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
  mix-blend-mode: difference; /* Show as reveal effect */
}

.drip-toggle-btn {
  width: 35px !important;
  height: 35px !important;
  border-radius: 50% !important;
  background: #fff !important;
  opacity: 1 !important; /* 100% opacity */
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5) !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0 !important;
  position: relative !important;
  overflow: hidden !important;
  flex-shrink: 0;
  margin-right: 5px;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

.drip-toggle-btn * {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

/* Clicked state - black background */
.drip-toggle-btn.reveal-mode {
  background: #000 !important;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5) !important;
}

/* Simplified hover states - only show subtle feedback on desktop */
@media (hover: hover) {
  .drip-toggle-btn:hover:not(.reveal-mode) {
    opacity: 0.8 !important;
    filter: brightness(1.1) contrast(1.1) !important;
  }

  .drip-toggle-btn:hover.reveal-mode {
    opacity: 0.8 !important;
    filter: brightness(1.1) contrast(1.1) !important;
  }
}

.drip-toggle-btn:active {
  transform: scale(0.95) !important;
  opacity: 0.7 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

/* Duplicate .done-btn rule removed - consolidated above */

.done-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  background: transparent;
  z-index: 2;
  pointer-events: none; /* Changed from auto to none to prevent interference */
}

.export-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  box-shadow: none;
  padding: 0;
  flex-shrink: 0;
  margin-right: 2px;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

.export-btn .export-icon {
  width: 35px;
  height: 35px;
  object-fit: contain;
  margin: 0;
  padding: 0;
  border: none;
  display: block;
}

#clearBtn {
  padding: 0;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  margin-left: 0px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

.clear-icon {
  width: 35px;
  height: 35px;
  object-fit: contain;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

#clearBtn:hover {
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

#clearBtn:hover .clear-icon {
  opacity: 0.3 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

#clearBtn:active {
  transform: none !important;
  box-shadow: none !important;
}

#clearBtn:active .clear-icon {
  opacity: 0.2 !important;
  filter: brightness(1.2) contrast(1.1) !important;
}

/* Clear button shoot out animation */
@keyframes shootRight {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(50px);
  }
}
.hint{opacity:.6; font-size:12px}

/* Hide UI state - improved for smoother transitions */
.ui-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* Completely hidden state - applied after transition completes */
.ui-hidden.completely-hidden {
  display: none !important;
}

/* Top button fade states */
.top-btn.ui-fading-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

.top-btn.ui-fading-in {
  opacity: 0.5 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.top-btn.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Top Row Buttons - Side by side, higher position, 15% bigger */
.top-btn {
  position: absolute;
  top: 100px; /* Higher position closer to logo */
  width: 115px; /* 15% bigger (100px * 1.15) */
  height: 115px; /* 15% bigger (100px * 1.15) */
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  visibility: visible;
  opacity: 0.5;
  box-shadow: none;
  padding: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.draw-btn {
  left: 50%;
  transform: translateX(-172.5px); /* Left button: -115px - 57.5px = -172.5px */
}

.audio-btn {
  left: 50%;
  transform: translateX(-57.5px); /* Center button: -115px/2 = -57.5px */
}

.credits-btn {
  left: 50%;
  transform: translateX(57.5px); /* Right button: +57.5px */
}

.top-btn-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(1.2) contrast(1.1);
  opacity: 1;
  mix-blend-mode: normal;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

/* Draw button with lightened blend mode */
.draw-icon {
  mix-blend-mode: lighten;
}

/* Hover states for top buttons */
.top-btn:hover {
  opacity: 1;
}

.top-btn:hover .top-btn-icon {
  filter: brightness(1.3) contrast(1.2);
}

/* Persistent Logo Overlay - Matching existing logo-element */
.logo-overlay {
  position: absolute !important;
  top: -20px !important; /* 20px higher than the top of viewport */
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 10 !important; /* Above background layers including credits overlay */
  pointer-events: none !important; /* Don't interfere with canvas interactions */
  width: 100% !important;
  height: 140px !important;
  max-width: 372px !important;
}

.persistent-logo {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  filter: none !important; /* Match original styling */
  opacity: 1 !important;
  transition: opacity 0.3s ease, mix-blend-mode 0.3s ease, filter 0.8s ease-in-out !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  mix-blend-mode: normal;
}

/* Logo with exclusion blend mode when credits are active */
.persistent-logo.credits-active {
  mix-blend-mode: hard-light !important;
  z-index: 16 !important; /* Above graphic element (15) when credits are active */
  filter: invert(1) !important; /* Invert the logo to make it black/white inverted */
  transition: mix-blend-mode 0.8s ease-in-out, filter 0.8s ease-in-out !important;
}

/* Draw Hint Text */
.draw-hint {
  position: fixed;
  top: 80px; /* 10px higher than before */
  left: 50%;
  transform: translateX(-50%); /* Start centered */
  z-index: 1000;
  pointer-events: none;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 8px;
  color: #fff; /* Inverted color (white) */
  text-align: center;
  white-space: nowrap;
  display: none; /* Hidden by default */
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

/* Show draw hint when drawing mode is active */
.stage.drawing-mode .draw-hint {
  display: block;
  animation: slideUpFadeIn 0.8s ease-out forwards;
}

/* Draw hint entrance animation */
@keyframes slideUpFadeIn {
  0% {
    opacity: 0;
    top: 110px; /* Start 30px below final position (80px + 30px) */
  }
  100% {
    opacity: 1;
    top: 80px; /* Final position */
  }
}

/* Draw hint fade out animation */
.draw-hint.fade-out {
  opacity: 0 !important;
  transition: opacity 1.5s ease-out !important;
  animation: none !important; /* Stop the entrance animation */
}

/* Show different hints based on device type */
.desktop-hint {
  display: block;
}

.mobile-hint {
  display: none;
}

/* Show mobile hint on mobile devices */
@media (max-width: 768px) {
  .desktop-hint {
    display: none;
  }
  
  .mobile-hint {
    display: block;
  }
}

/* Audio Player Styles */
.audio-player {
  position: absolute !important;
  top: calc(50% - 190px) !important; /* Moved down 2px more */
  left: 50% !important;
  transform: translateX(-50%) !important; /* Only center horizontally, not vertically */
  width: 90%;
  max-width: 350px;
  background: transparent;
  border-radius: 12px;
  padding: 20px;
  z-index: 100000;
}


.audio-tracklist {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audio-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative; /* Allow for absolute positioning of controls */
  min-height: auto; /* Allow height to expand */
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-number {
  color: #FFF;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
}

.track-duration {
  color: #FFF;
  font-family: "Big Caslon", serif;
  font-size: 15px;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
}

.track-title {
  color: #FFF;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
  margin-top: 2px;
}

.track-number,
.track-title {
  cursor: pointer;
}

.audio-controls {
  display: none;
  align-items: center;
  gap: 20px; /* Increased from 10px to 20px for 10px additional gap */
  margin-top: 8px; /* Add some space between track info and controls */
  background: transparent;
}

.audio-controls.active {
  display: flex;
}

.play-pause-btn {
  min-width: 50px;
  height: 26px;
  padding: 0 12px;
  border: none;
  border-radius: 13px;
  background: #FFF;
  color: #000;
  font-size: 9px;
  font-weight: 500;
  font-family: "Eurostile LT Std", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.9;
  white-space: nowrap;
}

.play-pause-btn:hover {
  background: #ccc;
  opacity: 1;
}

.audio-timeline {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.timeline-progress {
  height: 100%;
  background: #FFF;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s ease;
}

.timeline-scrubber {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background-image: url('./imgs/srubber.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s ease;
}


/* Mobile responsive adjustments for audio player */
@media (max-width: 767px) {
  .audio-player {
    width: 95%;
    max-width: none;
    padding: 15px;
    top: calc(50% - 120px) !important; /* Moved down 30px total for mobile */
    left: 50% !important;
    transform: translateX(-50%) !important; /* Only center horizontally, not vertically */
  }
  
  .track-number,
  .track-title {
    font-size: 11px; /* Match credit-link mobile size */
  }
  
  .track-duration {
    font-size: 15px; /* Keep duration at 15px */
  }
  
  /* Mobile play button styling - consistent with desktop */
  .play-pause-btn {
    min-width: 50px;
    height: 26px;
    padding: 0 12px;
    font-size: 9px;
    font-weight: 500;
    border-radius: 13px;
  }
  
  /* Enhanced mobile timeline scrubbing */
  .audio-timeline {
    height: 6px; /* Slightly taller for easier touch interaction */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
  }
  
  .timeline-scrubber {
    width: 24px; /* Larger hit area for mobile */
    height: 24px;
    /* Ensure smooth touch interaction */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .timeline-progress {
    height: 100%;
    background: #FFF;
    border-radius: 3px; /* Slightly more rounded for mobile */
  }
}

/* Credits Overlay Box - default for background 1 */
.credits-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #D9D9D9;
  mix-blend-mode: hard-light;
  z-index: 7; /* Second highest - below graphic element (15), above star grid (6) */
  pointer-events: none;
  opacity: 0; /* Start invisible to prevent blink */
  transition: opacity 0.4s ease-in-out, mix-blend-mode 0.4s ease-in-out;
}

/* Credits Overlay for background 4 - transparent (no grey background) positioned under bg_04.png */
#background-4 .credits-overlay {
  background-color: transparent !important;
  mix-blend-mode: normal !important;
  z-index: 1 !important; /* Under the background image (z-index: 2) */
}

/* Credits Overlay for background 5 - transparent overlay, exclusion blend applied to background image */
#background-5 .credits-overlay {
  background-color: transparent !important;
  mix-blend-mode: normal !important;
  z-index: 1 !important; /* Under the background image */
}

/* Duplicate rule removed - defined above */

/* Credits Overlay for background 2 - transparent overlay, exclusion blend applied to background image */
#background-2 .credits-overlay {
  background-color: transparent !important;
  mix-blend-mode: normal !important;
  z-index: 1 !important; /* Under the background image */
}

/* Duplicate rule removed - defined above */

/* Credits Overlay for background 3 - transparent overlay, exclusion blend applied to background image */
#background-3 .credits-overlay {
  background-color: transparent !important;
  mix-blend-mode: normal !important;
  z-index: 1 !important; /* Under the background image */
}

/* Duplicate rule removed - defined above */

/* Credits Artwork - positioned like in screenshot */
.credits-artwork {
  position: absolute;
  top: calc(85% + 20px); /* Moved much lower, closer to bottom */
  left: 10%;
  width: 202.74px; /* Original scale maintained */
  height: 202.74px; /* Original scale maintained */
  background-image: url('./imgs/Artwork.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transform: translateY(-50%);
  z-index: 12; /* Above background images (z-index: 10) */
  pointer-events: none;
  opacity: 0; /* Start invisible to prevent blink */
  transition: opacity 0.4s ease-in-out;
}

/* Mobile positioning for credits artwork */
@media (max-width: 767px) {
  .credits-artwork {
    top: calc(85% + 20px); /* Moved much lower, closer to bottom on mobile too */
    left: 5%; /* More centered on mobile */
    width: 162.19px; /* 20% smaller than desktop (202.74px * 0.80) */
    height: 162.19px; /* 20% smaller than desktop (202.74px * 0.80) */
  }
}

/* Credits Star Bottom - positioned at bottom like in screenshot */
.credits-star-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 500px; /* Increased height to show more of the image */
  background-image: url('./imgs/star bottom.png');
  background-size: contain; /* Changed to contain to show full image */
  background-position: center bottom;
  background-repeat: no-repeat;
  z-index: 13; /* Above artwork and background images */
  pointer-events: none;
  opacity: 0; /* Start invisible to prevent blink */
  transition: opacity 0.4s ease-in-out;
}

/* Mobile positioning for credits star bottom */
@media (max-width: 767px) {
  .credits-star-bottom {
    height: 300px; /* Smaller height for mobile */
  }
}

/* Credits Modal Styles */
.credits-modal {
  position: absolute;
  top: calc(50% - 20px); /* Moved up by another 30px (was +10px, now -20px) */
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 350px;
  background: transparent;
  padding: 20px;
  z-index: 100000;
}

.credits-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.credits-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-link {
  color: #000;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 143.574%; /* 17.229px */
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

/* Mobile and tablet inherit desktop styles by default */

.credit-link:hover {
  opacity: 0.5;
}

/* Hover state for credit links on background 1 (default) */
#background-1 .credit-link:hover {
  opacity: 0.5 !important;
}

/* Hover state for credit links on background 1 when credits are active */
#background-1.credits-active .credit-link:hover {
  opacity: 0.5 !important;
}

/* Hover states for fade-in credit links - override animation */
.credit-link.fade-in:hover {
  opacity: 0.5 !important;
}

#background-1.credits-active .credit-link.fade-in:hover {
  opacity: 0.5 !important;
}

/* Credits text elements use the same fade-in system as audio player */

.credits-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.credits-text p {
  color: #000;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  margin: 0;
  text-transform: uppercase;
}

/* Mobile and tablet inherit desktop styles by default */

/* White text for backgrounds 2, 3, 4, and 5 */
#background-2.credits-active .credit-link,
#background-3.credits-active .credit-link,
#background-4.credits-active .credit-link,
#background-5.credits-active .credit-link {
  color: #fff !important;
}

/* Hover states for credit links on backgrounds 2, 3, 4, and 5 */
#background-2.credits-active .credit-link:hover,
#background-3.credits-active .credit-link:hover,
#background-4.credits-active .credit-link:hover,
#background-5.credits-active .credit-link:hover {
  opacity: 0.5 !important;
}

#background-2.credits-active .credits-text p,
#background-3.credits-active .credits-text p,
#background-4.credits-active .credits-text p,
#background-5.credits-active .credits-text p {
  color: #fff !important;
}

/* Additional specificity for backgrounds 2 and 4 */
.stage-background-bg02.credits-active .credit-link,
.stage-background-bg04.credits-active .credit-link {
  color: #fff !important;
}

/* Hover states for additional specificity backgrounds 2 and 4 */
.stage-background-bg02.credits-active .credit-link:hover,
.stage-background-bg04.credits-active .credit-link:hover {
  opacity: 0.5 !important;
}

.stage-background-bg02.credits-active .credits-text p,
.stage-background-bg04.credits-active .credits-text p {
  color: #fff !important;
}

/* Debug: Force white text for all credit elements when any background has credits-active */
.credit-link {
  color: #000;
}

.credits-text p {
  color: #000;
}

/* Override with white when credits are active on any background */
body:has(#background-2.credits-active) .credit-link,
body:has(#background-3.credits-active) .credit-link,
body:has(#background-4.credits-active) .credit-link,
body:has(#background-5.credits-active) .credit-link {
  color: #fff !important;
}

/* Hover states for body selectors when credits are active */
body:has(#background-2.credits-active) .credit-link:hover,
body:has(#background-3.credits-active) .credit-link:hover,
body:has(#background-4.credits-active) .credit-link:hover,
body:has(#background-5.credits-active) .credit-link:hover {
  opacity: 0.5 !important;
}

body:has(#background-2.credits-active) .credits-text p,
body:has(#background-3.credits-active) .credits-text p,
body:has(#background-4.credits-active) .credits-text p,
body:has(#background-5.credits-active) .credits-text p {
  color: #fff !important;
}


/* Mobile responsive adjustments for drawing controls */
@media (max-width: 767px) {
  .drawing-controls {
    left: 10px !important;
    right: 10px !important;
    transform: none !important;
    width: auto !important;
    justify-content: space-between !important;
  }
}

/* Mobile-only class - hide on desktop and tablet */
.mobile-only {
  display: none !important;
}

@media (max-width: 767px) {
  .mobile-only {
    display: block !important;
  }
}

/* PERCARE links styling - matches pause button shape and positioning */
.credits-percare-links {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none; /* Hidden by default */
  gap: 40px;
  align-items: center;
  z-index: 100001;
}

/* Show PERCARE links only when credits modal is visible AND on mobile only */
@media (max-width: 767px) {
  .credits-percare-links.mobile-only {
    display: none !important;
  }
  
  body:has(.credits-active) .credits-percare-links.mobile-only {
    display: flex !important;
  }
}

/* Ensure mobile-only credits links are hidden on tablet and desktop */
@media (min-width: 768px) {
  .credits-percare-links.mobile-only {
    display: none !important;
  }
}

.percare-link {
  min-width: 50px;
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 15px;
  background: #646464;
  color: #FFF;
  font-size: 11px;
  font-weight: 500;
  font-family: "Eurostile LT Std", sans-serif;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.9;
}

/* Hover states for fade-in percare links - override animation */
.percare-link.fade-in:hover {
  background: #555 !important;
  opacity: 1 !important;
  color: #FFF !important;
}

#background-1.credits-active .percare-link.fade-in:hover {
  background: #555 !important;
  opacity: 1 !important;
  color: #FFF !important;
}

/* PERCARE links always have white text - override any black text rules */
.percare-link {
  color: #FFF !important;
}

.percare-link:hover {
  background: #555;
  opacity: 1;
  color: #FFF !important;
}

/* Mobile responsive adjustments for credits modal */
@media (max-width: 767px) {
  .credits-modal {
    width: 95%;
    max-width: none;
    padding: 15px;
    top: calc(50% + 30px); /* Moved down 10px more to match audio player positioning */
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .credits-content {
    gap: 15px; /* Reduced gap for mobile */
  }
  
  .credits-links {
    gap: 2px; /* Match desktop gap */
  }
  
  .credit-link {
    font-size: 11px;
    line-height: 143.574%; /* Match desktop line-height */
  }
  
  .credits-text p {
    font-size: 11px;
    line-height: 1.4; /* Explicitly match desktop */
  }
  
  .percare-link {
    font-size: 11px;
    line-height: 143.574%; /* Match desktop line-height */
  }
  
  /* Mobile safe area positioning for PERCARE links */
  .credits-percare-links {
    bottom: max(20px, calc(var(--safe-area-inset-bottom, 0px) + 20px));
  }
}

/* Desktop and tablet - just ensure no scrolling */
@media (min-width: 768px) {
  html, body {
    overflow: hidden;
  }
}

/* ===== FADE-IN ANIMATIONS ===== */

/* Elements that should fade in start invisible */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

/* Once animation has been shown, keep opacity at 1 */
.fade-in.animation-shown {
  opacity: 1 !important;
  animation: none !important;
}

/* Shadows element base styles */
.shadows-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./imgs/Shadows.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: luminosity;
  z-index: 5;
  pointer-events: none;
  transition: mix-blend-mode 1.2s ease-in-out, opacity 1.2s ease-in-out;
}

/* Ensure shadows element starts at opacity 0 and goes to 100% */
.shadows-element.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

/* Simple fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Staggered delays for sequential appearance */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
.delay-5 { animation-delay: 1.0s; }
.delay-6 { animation-delay: 1.2s; }
.delay-7 { animation-delay: 1.4s; }
.delay-8 { animation-delay: 1.6s; }
.delay-9 { animation-delay: 1.8s; }
.delay-10 { animation-delay: 2.0s; }

/* ===== DESKTOP AND TABLET CTA BUTTONS ===== */

/* CTA Buttons Container - Hidden on mobile */
.cta-buttons {
  display: none;
}

/* Show CTA buttons only on tablet and desktop */
@media (min-width: 768px) {
  .cta-buttons {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to content below */
    z-index: 500; /* Above background but below phone content */
  }
}

/* Individual CTA Button Styling */
.cta-button {
  display: flex;
  width: 140px;
  height: 40px;
  padding: 4px 16px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border-radius: 20px;
  background: #646464;
  color: #fff;
  font-family: "Eurostile LT Std", sans-serif;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  text-decoration: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto; /* Enable clicks on buttons */
  transition: all 0.3s ease;
  z-index: 501; /* Above container */
  box-sizing: border-box; /* Ensure padding is included in width */
}

/* Left CTA Button */
.cta-left {
  left: 0;
}

/* Right CTA Button */
.cta-right {
  right: 0;
}

/* Hover Effects */
.cta-button:hover {
  background: #555;
  transform: translateY(-50%) scale(1.05);
}

.cta-button:active {
  transform: translateY(-50%) scale(0.95);
}

/* Keep buttons vertically centered at all breakpoints */

/* Desktop short-height fit: keep 30px top/bottom gap and preserve aspect
   Placed at end of file so it overrides base .phone dimensions */
@media (min-width: 1025px) and (max-height: 900px) {
  .phone {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /* Ensure 30px gap top/bottom; do not exceed native height */
    height: min(844px, calc(100svh - 60px)) !important;
    /* Keep original width; only height scales down */
    width: 390px !important;
  }
}

