body {
  font-family: "Inter", sans-serif;
  touch-action: pan-y;
}
.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

/* Toolbar Layout */
.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 640px) {
  .editor-layout {
    flex-direction: row;
  }
  .canvas-section {
    flex: 1;
    min-width: 0;
  }
  .tools-section {
    width: 80px;
    flex-shrink: 0;
  }
}

/* Canvas Area */
.canvas-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 1;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0px;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  position: relative;
  touch-action: none; /* Prevent scroll while drawing */
  user-select: none;
}

#art-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated; /* Crucial for sharp pixels */
  cursor: crosshair;
}

#grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-size: calc(100% / var(--grid-size, 16))
    calc(100% / var(--grid-size, 16));
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
}
#grid-overlay.hidden {
  display: none;
}

/* Tools */
.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #f3f4f6;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tool-btn:hover {
  background: #e5e7eb;
}
.tool-btn.active {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}

/* Palette */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
@media (min-width: 640px) {
  .palette-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
.color-swatch {
  aspect-ratio: 1;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.1);
  transition:
    transform 0.1s,
    border-color 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.color-swatch:hover {
  transform: scale(1.1);
}
.color-swatch.active {
  border-color: #111;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* Buttons */
.action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}
.action-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
.primary-btn {
  background: #10b981;
  border-color: #059669;
  color: #fff;
}
.primary-btn:hover {
  background: #059669;
  border-color: #047857;
}
.primary-btn:disabled {
  background: #059669;
  border-color: #047857;
  pointer-events: none;
}

.related-game-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
.related-game-card:hover {
  border-color: #6ee7b7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}
.related-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
