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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  min-height: 100vh;
  color: #e2e8f0;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(30, 30, 50, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  z-index: 1000;
  flex-wrap: wrap;
  gap: 10px;
}

.header-left {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 200px;
}

.header-right {
  display: flex;
  gap: 10px;
}

/* Chaos Meter */
.chaos-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.chaos-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: #94a3b8;
}

.chaos-bar-container {
  width: 120px;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.chaos-bar {
  height: 100%;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.chaos-bar.rainbow {
  background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #06b6d4, #8b5cf6, #ec4899);
  animation: rainbow-pulse 1s ease-in-out infinite;
}

.chaos-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 40px;
}

.nice-badge {
  font-size: 0.75rem;
  color: #ff00ff;
  animation: pulse 0.5s ease-in-out infinite;
}

/* Buttons */
.tutorial-toggle, .reset-button {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
}

.tutorial-toggle:hover, .reset-button:hover {
  background: rgba(139, 92, 246, 0.2);
  transform: translateY(-1px);
}

.tutorial-toggle.active {
  background: #8b5cf6;
  color: white;
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Draggable Elements */
.draggable-element {
  user-select: none;
  transition: box-shadow 0.2s ease;
}

.draggable-element.dragging {
  z-index: 1000;
  box-shadow: 0 20px 40px rgba(139, 92, 246, 0.4);
}

/* Toolbar */
.toolbar {
  background: rgba(30, 30, 50, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  min-width: 70px;
}

.toolbar-header {
  font-size: 0.7rem;
  color: #64748b;
  margin-bottom: 10px;
  cursor: grab;
}

.toolbar-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toolbar-tip {
  font-size: 0.6rem;
  color: #475569;
  margin-top: 10px;
  text-align: center;
}

.tool-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  border-width: 2px;
  border-style: solid;
}

.tool-button:hover {
  transform: scale(1.1);
}

.tool-button.selected {
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Canvas */
.canvas-container {
  background: rgba(30, 30, 50, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  overflow: hidden;
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  color: #64748b;
  cursor: grab;
}

.canvas-size {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.canvas-area {
  background: #1e1e2e;
  position: relative;
  cursor: crosshair;
}

.shape {
  position: absolute;
  transition: transform 0.1s ease;
}

.shape:hover {
  transform: scale(1.02);
}

/* Properties Panel */
.properties-panel {
  background: rgba(30, 30, 50, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  width: 220px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  color: #64748b;
  cursor: grab;
}

.panel-badge {
  background: rgba(139, 92, 246, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  text-transform: capitalize;
}

.panel-content {
  padding: 14px;
}

.property-group {
  margin-bottom: 14px;
}

.property-group label {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

.property-group input[type="color"] {
  width: 100%;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.property-group input[type="range"] {
  width: 100%;
  accent-color: #8b5cf6;
}

.toggle-btn {
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: #8b5cf6;
  color: white;
}

.mock-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row span {
  font-size: 0.7rem;
  color: #64748b;
  width: 14px;
}

.input-row input {
  flex: 1;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  width: 100%;
}

/* Tutorial Guide */
.tutorial-guide {
  z-index: 900;
}

.guide-character {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-body {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.guide-eyes {
  display: flex;
  gap: 10px;
}

.guide-eye {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  position: relative;
  transition: transform 0.2s ease;
}

.guide-eye::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background: #1a1a2e;
  border-radius: 50%;
  top: 2px;
  left: 2px;
}

.sweat-drop {
  position: absolute;
  top: -8px;
  right: -4px;
  width: 8px;
  height: 12px;
  background: #06b6d4;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: drip 1s ease-in-out infinite;
}

.speech-bubble {
  position: absolute;
  top: 70px;
  left: -80px;
  width: 220px;
  padding: 12px 14px;
  background: rgba(30, 30, 50, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 100px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(139, 92, 246, 0.4);
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(20, 20, 35, 0.95);
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  font-size: 0.75rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 10px;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tool-indicator {
  font-family: 'JetBrains Mono', monospace;
  text-transform: capitalize;
}

.personality-badge {
  padding: 4px 10px;
  border-radius: 12px;
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
}

.berrry-link {
  color: #8b5cf6;
  text-decoration: none;
  transition: color 0.2s ease;
}

.berrry-link:hover {
  color: #a78bfa;
}

/* Easter Eggs */
.easter-egg {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(249, 115, 22, 0.9);
  border-radius: 8px;
  font-size: 0.875rem;
  color: white;
  animation: bounce 0.5s ease;
  z-index: 1000;
}

.achievement {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.5);
  animation: achievement-pop 0.5s ease;
  z-index: 1001;
}

.achievement-icon {
  font-size: 2rem;
}

.achievement-text {
  display: flex;
  flex-direction: column;
}

.achievement-text strong {
  font-size: 1rem;
  color: #1a1a2e;
}

.achievement-text span {
  font-size: 0.8rem;
  color: #451a03;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  animation: confetti-fall 3s ease-out forwards;
}

/* Animations */
@keyframes wobble {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@keyframes drip {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(5px); opacity: 0.7; }
}

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

@keyframes rainbow-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

@keyframes bounce {
  0% { transform: translateX(-50%) translateY(20px); opacity: 0; }
  50% { transform: translateX(-50%) translateY(-5px); }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes achievement-pop {
  0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
  50% { transform: translateX(-50%) scale(1.1); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-header {
    padding: 10px 14px;
  }

  .app-title {
    font-size: 1rem;
  }

  .header-right {
    flex-wrap: wrap;
  }

  .chaos-bar-container {
    width: 80px;
  }

  .properties-panel {
    width: 180px;
  }

  .speech-bubble {
    width: 180px;
    left: -60px;
    font-size: 0.75rem;
  }

  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .tutorial-toggle, .reset-button {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .header-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .chaos-meter {
    width: 100%;
    justify-content: space-between;
  }

  .chaos-bar-container {
    flex: 1;
    max-width: 120px;
  }
}