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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

header {
  background: #16213e;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0f3460;
}

header h1 { color: #e94560; font-size: 1.5rem; }

nav button {
  background: #0f3460;
  color: #eee;
  border: none;
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

nav button:hover, nav button.active {
  background: #e94560;
}

#user-info {
  margin-left: 1rem;
  color: #aaa;
}

.view { display: none; padding: 2rem; }
.view.active { display: block; }

/* Gallery */
.toolbar {
  margin-bottom: 1rem;
}

.toolbar button {
  background: #e94560;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  margin-right: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.image-card {
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.image-card canvas {
  width: 100%;
  height: 200px;
  image-rendering: pixelated;
}

.image-card .info {
  padding: 0.75rem;
}

.image-card .info h4 {
  color: #e94560;
  margin-bottom: 0.25rem;
}

.image-card .info p {
  color: #888;
  font-size: 0.85rem;
}

.image-card .actions {
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.image-card .actions button {
  background: #0f3460;
  color: #eee;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.image-card .actions button:hover {
  background: #e94560;
}

/* Editor */
.editor-layout {
  display: flex;
  gap: 2rem;
  height: calc(100vh - 100px);
}

.sidebar {
  width: 220px;
  background: #16213e;
  border-radius: 8px;
  padding: 1rem;
  overflow-y: auto;
}

.tool-section {
  margin-bottom: 1.5rem;
}

.tool-section h3 {
  color: #e94560;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.tool {
  background: #0f3460;
  color: #eee;
  border: 2px solid transparent;
  padding: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.25rem;
}

.tool.active, .tool:hover {
  border-color: #e94560;
  background: #1a1a2e;
}

.palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.palette-color {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
}

.palette-color:hover, .palette-color.active {
  border-color: #fff;
}

#color-picker {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.sidebar label {
  display: block;
  margin: 0.5rem 0;
  color: #aaa;
}

.sidebar input[type="number"] {
  width: 60px;
  background: #0f3460;
  color: #eee;
  border: 1px solid #333;
  padding: 0.25rem;
  border-radius: 4px;
}

.sidebar button {
  width: 100%;
  background: #0f3460;
  color: #eee;
  border: none;
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 4px;
  cursor: pointer;
}

.sidebar button:hover {
  background: #e94560;
}

.canvas-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0f0f23;
  border-radius: 8px;
  overflow: auto;
}

#canvas-container {
  padding: 2rem;
}

#pixel-canvas {
  image-rendering: pixelated;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  cursor: crosshair;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.active { display: flex; }

.modal-content {
  background: #16213e;
  padding: 2rem;
  border-radius: 8px;
  min-width: 300px;
  position: relative;
}

.modal-content h2 {
  color: #e94560;
  margin-bottom: 1rem;
}

.modal-content input, .modal-content textarea {
  width: 100%;
  background: #0f3460;
  color: #eee;
  border: 1px solid #333;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border-radius: 4px;
}

.modal-content textarea {
  min-height: 100px;
  resize: vertical;
}

.modal-content button {
  background: #e94560;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-top: 0.5rem;
}

.modal-content .close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  color: #888;
  font-size: 1.5rem;
  width: auto;
  padding: 0.25rem 0.5rem;
}

.modal-content .close:hover {
  color: #e94560;
}

.loading {
  text-align: center;
  color: #e94560;
  margin-top: 1rem;
}

#auth-toggle {
  margin-top: 1rem;
  text-align: center;
  color: #888;
}

#auth-toggle a {
  color: #e94560;
}

@media (max-width: 768px) {
  .editor-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  header { flex-direction: column; gap: 1rem; }
}
