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

html, body, #app {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  color: #fff;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header */
header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
  text-align: center;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.controls button, .controls a {
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #667eea;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.controls button:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.controls button:active {
  transform: translateY(0);
}

#downloadLink {
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: #fff;
}

/* Main canvas area */
main {
  flex: 1;
  position: relative;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 640px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.2);
}

#drawCanvas, #particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 24px;
}

#drawCanvas {
  background: rgba(255, 255, 255, 0.05);
  z-index: 10;
}

#particleCanvas {
  z-index: 20;
  pointer-events: none;
}

video {
  position: absolute;
  left: -9999px;
  visibility: hidden;
}

/* Footer */
footer {
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  text-align: center;
  flex-shrink: 0;
}

footer p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

/* Responsive */
@media (max-width: 480px) {
  header {
    padding: 12px 16px;
  }

  header h1 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .controls button {
    padding: 8px 12px;
    font-size: 12px;
  }

  main {
    padding: 12px;
  }
}

/* Touch optimization */
button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Canvas optimization */
canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
