/* styles.css */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

#splashScreen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    color: black;
    font-size: 16px;
    font-family: -apple-system, sans-serif;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border: 2px solid black;
    border-radius: 10px;
    padding: 20px;
    max-width: 80%;
    min-width: 200px;
    width: auto;
}

#headerLabel {
    position: fixed;
    top: 0;
    right: 0;
    margin: 3px;
    font-size: 16px;
    font-family: -apple-system, sans-serif;
    color: black;
    background-color: transparent;
    padding: 3px;
    border-radius: 3px;
    z-index: 10;

    /* Make header text unselectable */
    user-select: none;
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

button {
    margin-top: 5px;
    margin-bottom: 15px;
    padding: 0.3rem 20px;
    font-size: 16px;
    color: black;
    background-color: #ffffff;
    border: 2px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.25s;
}

#simpleButton {
    margin-right: 5px;
}

button:hover {
    background-color: #f0f0f0;
    scale: 1.02;
    border-color: #999;
}

    #fancyButton {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
      background-size: 200% 200%;
      color: #ffffff;
      padding: 0.3rem 20px;
      font-size: 16px;
      font-weight: 600;
      border: 2px solid #ffffff;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.25s, box-shadow 0.2s;
      position: relative;
      overflow: hidden;
      box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
      animation: gradientShift 3s ease infinite;
    }

/* Sparkle effect */
#fancyButton::before {
  content: '✨';
  position: absolute;
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0;
  animation: sparkleLeft 4s ease-in-out infinite;
}

#fancyButton::after {
  content: '✨';
  position: absolute;
  top: 50%;
  right: -20px;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0;
  animation: sparkleRight 4s ease-in-out infinite;
  animation-delay: 2s;
}

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

@keyframes sparkleLeft {
  0%, 100% {
    left: -20px;
    opacity: 0;
    transform: translateY(-50%) scale(0.5) rotate(0deg);
  }
  50% {
    left: 10%;
    opacity: 1;
    transform: translateY(-50%) scale(1) rotate(180deg);
  }
}

@keyframes sparkleRight {
  0%, 100% {
    right: -20px;
    opacity: 0;
    transform: translateY(-50%) scale(0.5) rotate(0deg);
  }
  50% {
    right: 10%;
    opacity: 1;
    transform: translateY(-50%) scale(1) rotate(-180deg);
  }
}

#fancyButton:hover {
    scale: 1.02;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6), 0 0 30px rgba(240, 147, 251, 0.4);
    animation: gradientShift 1.5s ease infinite, pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(1.08);
  }
}

/* Fancy mode styles */
@keyframes fadeIn {
  to { opacity: 1; }
}

#toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 15px 25px;
  border-radius: 50px;
  display: flex;
  gap: 15px;
  align-items: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 100;
  opacity: 0;
  animation: slideUp 0.3s ease forwards;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#toolbar.minimized {
  padding: 12px;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  gap: 0;
  overflow: hidden;
}

#toolbar.minimized > *:not(#toggleToolbar) {
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#toolbar > *:not(#toggleToolbar) {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#toolbar.minimized #toggleToolbar {
  margin: 0;
  padding: 0;
}

@keyframes slideUp {
  to { opacity: 1; }
}

.tool-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  align-self: center;
  margin: 0;
  padding: 0;
}

#toggleToolbar {
  transition: transform 0.3s ease;
}

#toolbar.minimized #toggleToolbar {
  transform: rotate(180deg);
}

.tool-btn:hover {
  background: #e0e0e0;
  transform: scale(1.1);
}

.tool-btn:active {
  transform: scale(0.95);
}

#colorPicker {
  width: 44px;
  height: 44px;
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  padding: 0;
  overflow: hidden;
  touch-action: manipulation;
  flex-shrink: 0;
  align-self: center;
  margin: 0;
}

#colorPicker::-webkit-color-swatch-wrapper {
  padding: 0;
  border: none;
  border-radius: 50%;
}

#colorPicker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

#colorPicker::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

#colorPicker:hover {
  transform: scale(1.1);
}

#brushSize {
  width: 100px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  border-radius: 3px;
  outline: none;
  flex-shrink: 0;
  align-self: center;
}

#brushSize::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: transform 0.2s;
}

#brushSize::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#brushSize::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
}

.divider {
  width: 1px;
  height: 30px;
  background: #ddd;
  flex-shrink: 0;
  transition: opacity 0.2s;
  align-self: center;
}

#brushPreview {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  z-index: 99;
  display: none;
  transform: translate(-50%, -50%);
}

@media (max-width: 600px) {
  #toolbar {
    padding: 10px 15px;
    gap: 8px;
  }
  
  #toolbar.minimized {
    padding: 0;
    width: 36px;
    height: 36px;
  }
  
  .tool-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  #toggleToolbar {
    width: 36px;
    height: 36px;
  }
  
  #toolbar.minimized #toggleToolbar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #colorPicker {
    width: 36px;
    height: 36px;
    /* Improve touch interaction on mobile */
    -webkit-tap-highlight-color: transparent;
  }
  
  #brushSize {
    width: 60px;
    height: 4px;
  }
  
  #brushSize::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }
  
  #brushSize::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
  
  .divider {
    height: 24px;
  }
  
  /* Hide some dividers on mobile to save space */
  .divider:first-of-type {
    display: none;
  }
}