/* Google Font - Pixelated */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --sand-100: #f4e4c1;
  --sand-200: #e8d4a0;
  --sand-300: #dbc280;
  --sand-400: #d4a574;
  --sand-500: #c89968;
  --coral: #ff6b6b;
  --turquoise: #4ecdc4;
  --sunset: #ffa07a;
  --ocean: #5fa8d3;
  --lavender: #b39ddb;
  --mint: #7bed9f;
  --bg-dark: #2c1810;
  --bg-darker: #1a0f08;
  --text-light: #fff5e6;
  --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Press Start 2P', cursive;
  background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
  color: var(--text-light);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ==================== LANDING PAGE ==================== */

.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.sand-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, var(--sand-300), transparent),
    radial-gradient(2px 2px at 60% 70%, var(--sand-400), transparent),
    radial-gradient(1px 1px at 50% 50%, var(--sand-200), transparent),
    radial-gradient(1px 1px at 80% 10%, var(--sunset), transparent),
    radial-gradient(2px 2px at 90% 60%, var(--turquoise), transparent),
    radial-gradient(1px 1px at 33% 80%, var(--coral), transparent);
  background-size: 200% 200%;
  animation: particleFloat 20s ease-in-out infinite;
  opacity: 0.3;
  pointer-events: none;
}

@keyframes particleFloat {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

.landing-content {
  max-width: 900px;
  text-align: center;
  z-index: 1;
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-container {
  margin-bottom: 2rem;
}




.glitch {
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: bold;
  text-transform: uppercase;
  position: relative;
  color: var(--sand-200);
  text-shadow: 
    3px 3px 0 var(--sand-400),
    6px 6px 0 var(--sand-500),
    2px 2px 20px var(--sunset);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.tagline {
  font-size: clamp(0.5rem, 2vw, 0.8rem);
  color: var(--sand-300);
  margin-bottom: 3rem;
  letter-spacing: 0.15em;
  opacity: 0.9;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.05);
  border: 3px solid var(--sand-400);
  padding: 2rem 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 0 var(--shadow);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 0 var(--shadow);
  border-color: var(--turquoise);
  background: rgba(78, 205, 196, 0.1);
}

.pixel-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  image-rendering: pixelated;
  position: relative;
}

.spawn-icon {
  background: var(--turquoise);
  box-shadow: 
    inset -4px -4px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.3);
}

.spawn-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 4px;
  background: white;
  box-shadow: 0 -8px 0 white, 0 8px 0 white;
}

.spawn-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 50%;
  background: white;
  box-shadow: -8px 0 0 white, 8px 0 0 white;
}

.physics-icon {
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 
    inset -4px -4px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.3);
}

.physics-icon::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid white;
}

.desktop-icon {
  background: var(--sunset);
  box-shadow: 
    inset -4px -4px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.3);
}

.desktop-icon::before {
  content: '';
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  background: white;
  opacity: 0.8;
}

.feature-card h3 {
  font-size: 0.75rem;
  margin-bottom: 1rem;
  color: var(--sand-200);
}

.feature-card p {
  font-size: 0.5rem;
  line-height: 1.6;
  color: var(--sand-300);
  font-family: monospace;
  letter-spacing: 0.05em;
}

.pixel-button {
  background: linear-gradient(135deg, var(--turquoise) 0%, var(--ocean) 100%);
  color: white;
  border: 4px solid var(--text-light);
  padding: 1.2rem 3rem;
  font-size: 0.9rem;
  font-family: 'Press Start 2P', cursive;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 
    0 6px 0 var(--ocean),
    0 8px 10px var(--shadow);
  overflow: hidden;
}

.pixel-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 0 var(--ocean),
    0 12px 15px var(--shadow);
}

.pixel-button:active {
  transform: translateY(4px);
  box-shadow: 
    0 2px 0 var(--ocean),
    0 3px 5px var(--shadow);
}

.pixel-button span {
  position: relative;
  z-index: 2;
}

.button-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) translateY(-100%); }
  100% { transform: translateX(100%) translateY(100%); }
}

.creator-links {
  margin-top: 3rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--sand-400);
  color: var(--sand-200);
  text-decoration: none;
  font-size: 0.6rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 0 var(--shadow);
}

.social-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 var(--shadow);
  border-color: var(--turquoise);
  background: rgba(78, 205, 196, 0.1);
}

.social-link svg {
  transition: transform 0.3s ease;
}

.social-link:hover svg {
  transform: scale(1.2);
}

/* ==================== CANVAS APP ==================== */

.canvas-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.app-header {
  background: linear-gradient(135deg, rgba(42, 24, 16, 0.95) 0%, rgba(26, 15, 8, 0.95) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--sand-400);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px var(--shadow);
}

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

.app-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--sand-200);
  white-space: nowrap;
}



.controls {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-group label {
  font-size: 0.6rem;
  color: var(--sand-300);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.mode-controls {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border: 2px solid var(--sand-500);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  color: var(--sand-300);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.control-btn.active {
  background: var(--turquoise);
  color: white;
  border-color: var(--text-light);
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

.control-btn svg {
  flex-shrink: 0;
}

.brush-size {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border: 2px solid var(--sand-500);
}

#size-slider {
  width: 120px;
  height: 8px;
  background: var(--bg-dark);
  border: 2px solid var(--sand-400);
  outline: none;
  cursor: pointer;
}

#size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--turquoise);
  border: 2px solid white;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

#size-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--turquoise);
  border: 2px solid white;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

#size-value {
  font-size: 0.7rem;
  color: var(--turquoise);
  min-width: 20px;
  text-align: center;
  font-weight: bold;
}

.color-controls {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border: 2px solid var(--sand-500);
}

#palette {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--sand-400);
  color: var(--sand-200);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--turquoise);
  color: var(--turquoise);
  transform: scale(1.05);
}

.canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: 
    linear-gradient(45deg, transparent 48%, rgba(212, 165, 116, 0.1) 49%, rgba(212, 165, 116, 0.1) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(212, 165, 116, 0.1) 49%, rgba(212, 165, 116, 0.1) 51%, transparent 52%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.desktop-preview {
  width: 100%;
 
}


.preview-frame {
  background: rgba(0, 0, 0, 0.5);
  border: 4px solid var(--sand-400);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 
    0 10px 50px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.preview-header {
  background: linear-gradient(135deg, rgba(42, 24, 16, 0.95) 0%, rgba(26, 15, 8, 0.95) 100%);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 2px solid var(--sand-500);
}

.window-dots {
  display: flex;
  gap: 0.5rem;
}

.window-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.window-dots span:nth-child(1) { background: var(--coral); }
.window-dots span:nth-child(2) { background: var(--sunset); }
.window-dots span:nth-child(3) { background: var(--mint); }

.preview-label {
  font-size: 0.6rem;
  color: var(--sand-300);
  flex: 1;
  text-align: center;
}

.canvas-wrapper {
  width: auto;     /* adjust max size as you like */
  height: auto;
  aspect-ratio: 16 / 9;        /* 480 / 270 */
  position: relative;
  background: #000;
  margin: 0 auto;
}

.background-placeholder,
.background-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.background-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7);
}

.bg-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 2rem;
  border: 3px solid var(--sand-400);
  pointer-events: none;
}

.bg-overlay p {
  font-size: 0.8rem;
  color: var(--sand-200);
  margin-bottom: 0.5rem;
}

.bg-overlay small {
  font-size: 0.5rem;
  color: var(--sand-400);
  font-family: monospace;
}

#sand {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;     /* CSS size (visual) is controlled by wrapper */
  height: 100%;
  display: block;
  image-rendering: pixelated;  /* helps keep nearest-neighbor look on modern browsers */
  touch-action: none;         /* prevents scrolling when interacting on touch devices */
}

.app-footer {
  background: linear-gradient(135deg, rgba(42, 24, 16, 0.95) 0%, rgba(26, 15, 8, 0.95) 100%);
  backdrop-filter: blur(10px);
  border-top: 3px solid var(--sand-400);
  padding: 1rem 2rem;
  box-shadow: 0 -4px 20px var(--shadow);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.6rem;
  color: var(--sand-300);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--mint);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--sand-400);
  color: var(--sand-200);
  transition: all 0.2s ease;
}

.footer-links a:hover {
  background: rgba(78, 205, 196, 0.2);
  border-color: var(--turquoise);
  color: var(--turquoise);
  transform: translateY(-2px);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }

  .controls {
    gap: 1rem;
    width: 100%;
  }

  .control-group {
    flex-wrap: wrap;
    justify-content: center;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .glitch {
    font-size: 1.5rem;
  }

  .canvas-container {
    padding: 1rem;
  }
  
  .control-btn span {
    display: none;
  }
  
  #size-slider {
    width: 80px;
  }
}

@media (max-width: 480px) {
  .app-title span {
    display: none;
  }
  
  .pixel-button {
    padding: 1rem 2rem;
    font-size: 0.7rem;
  }
  
  .social-link span {
    display: none;
  }
}